Source Code Cross Referenced for Java2HtmlPluginTest.java in  » Code-Analyzer » Java2Html » de » java2html » plugin » jspwiki » test » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Code Analyzer » Java2Html » de.java2html.plugin.jspwiki.test 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package de.java2html.plugin.jspwiki.test;
002:
003:        import java.util.HashMap;
004:
005:        import junit.framework.TestCase;
006:
007:        import com.ecyrd.jspwiki.plugin.PluginException;
008:
009:        import de.java2html.JavaSourceConversionSettings;
010:        import de.java2html.options.JavaSourceStyleTable;
011:        import de.java2html.plugin.AbstractJava2HtmlPlugin;
012:        import de.java2html.plugin.jspwiki.Java2HtmlPlugin;
013:
014:        /**
015:         * @author Markus Gebhard
016:         */
017:        public class Java2HtmlPluginTest extends TestCase {
018:            private final static String SOURCE_CODE = "public class HelloWorld {\n"
019:                    + "  public static void main(String args[]) {\n"
020:                    + "    System.out.println(\"Hello World!\");\n"
021:                    + "  }\n"
022:                    + "}";
023:
024:            private final static String CONVERTED_HTML_DEFAULT_STYLE = AbstractJava2HtmlPlugin
025:                    .convert(SOURCE_CODE, AbstractJava2HtmlPlugin
026:                            .getDefaultSettings());
027:
028:            private Java2HtmlPlugin plugin;
029:
030:            private static String CONVERTED_HTML_MONOCHROME_STYLE;
031:
032:            static {
033:                JavaSourceConversionSettings monochromeOptions = AbstractJava2HtmlPlugin
034:                        .getDefaultSettings();
035:                monochromeOptions.getConversionOptions().setStyleTable(
036:                        JavaSourceStyleTable.getDefaultMonochromeStyleTable());
037:                CONVERTED_HTML_MONOCHROME_STYLE = AbstractJava2HtmlPlugin
038:                        .convert(SOURCE_CODE, monochromeOptions);
039:            }
040:
041:            protected void setUp() throws Exception {
042:                plugin = new Java2HtmlPlugin();
043:
044:            }
045:
046:            public void testThrowsUsageExceptionWhenNoSourceCodeGiven() {
047:                try {
048:                    plugin.execute(null, new HashMap());
049:                    fail();
050:                } catch (PluginException expected) {
051:                    assertEquals(Java2HtmlPlugin.DEFAULT_USAGE_MESSAGE,
052:                            expected.getMessage());
053:                }
054:            }
055:
056:            public void testConversionAsSourceParameter()
057:                    throws PluginException {
058:                HashMap map = new HashMap();
059:                map.put("source", SOURCE_CODE);
060:                assertEquals(CONVERTED_HTML_DEFAULT_STYLE, plugin.execute(null,
061:                        map));
062:            }
063:
064:            public void testConversionAsBodyParameter() throws PluginException {
065:                HashMap map = new HashMap();
066:                map.put("_body", SOURCE_CODE);
067:                assertEquals(CONVERTED_HTML_DEFAULT_STYLE, plugin.execute(null,
068:                        map));
069:            }
070:
071:            public void testConversionAsBodyParameterWithLeadingNewLine()
072:                    throws PluginException {
073:                /*
074:                 * Reason: JSPWiki does not automatically remove the extra newline in the
075:                 * multiline parameter _body
076:                 */
077:                HashMap map = new HashMap();
078:                map.put("_body", "\n" + SOURCE_CODE);
079:                assertEquals(CONVERTED_HTML_DEFAULT_STYLE, plugin.execute(null,
080:                        map));
081:            }
082:
083:            //TODO Dec 2, 2003 (Markus Gebhard): This test needs a WikiContext
084:            //  public void testConversionFromNonExistingFile() {
085:            //    HashMap map = new HashMap();
086:            //    map.put("url", "file:/i/am/not/existing/at/all.java");
087:            //    try {
088:            //      plugin.execute(null, map);
089:            //    }
090:            //    catch (PluginException expected) {
091:            //      //expected
092:            //    }
093:            //  }
094:
095:            public void testUsingDefaultStyleNameIsSameAsUsingDefaultStyle()
096:                    throws PluginException {
097:                HashMap map = new HashMap();
098:                map.put("source", SOURCE_CODE);
099:                map.put("style", AbstractJava2HtmlPlugin.getDefaultSettings()
100:                        .getConversionOptions().getStyleTable().getName());
101:                assertEquals(CONVERTED_HTML_DEFAULT_STYLE, plugin.execute(null,
102:                        map));
103:            }
104:
105:            public void testUsingMonochromeStyle() throws PluginException {
106:                HashMap map = new HashMap();
107:                map.put("source", SOURCE_CODE);
108:                map.put("style", JavaSourceStyleTable
109:                        .getDefaultMonochromeStyleTable().getName());
110:                assertEquals(CONVERTED_HTML_MONOCHROME_STYLE, plugin.execute(
111:                        null, map));
112:            }
113:
114:            public void testUnsupportedConversionStyle() {
115:                HashMap map = new HashMap();
116:                map.put("style", "a_definitely_not_existing_style");
117:                try {
118:                    plugin.execute(null, map);
119:                } catch (PluginException expected) {
120:                    //expected
121:                }
122:            }
123:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.