Source Code Cross Referenced for WikiUtilTest.java in  » Wiki-Engine » JAMWiki » org » jamwiki » utils » 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 » Wiki Engine » JAMWiki » org.jamwiki.utils 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE, version 2.1, dated February 1999.
003:         *
004:         * This program is free software; you can redistribute it and/or modify
005:         * it under the terms of the latest version of the GNU Lesser General
006:         * Public License as published by the Free Software Foundation;
007:         *
008:         * This program is distributed in the hope that it will be useful,
009:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
010:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
011:         * GNU Lesser General Public License for more details.
012:         *
013:         * You should have received a copy of the GNU Lesser General Public License
014:         * along with this program (LICENSE.txt); if not, write to the Free Software
015:         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
016:         *
017:         * Based on code generated by Agitar build: Agitator Version 1.0.2.000071 (Build date: Jan 12, 2007) [1.0.2.000071]
018:         */package org.jamwiki.utils;
019:
020:        import java.io.FileNotFoundException;
021:        import java.util.Locale;
022:        import junit.framework.TestCase;
023:        import org.jamwiki.WikiException;
024:        import org.jamwiki.WikiMessage; /* FIXME - re-enable
025:         import org.jamwiki.db.DatabaseUserHandler;
026:         */
027:        import org.jamwiki.model.Topic;
028:
029:        public class WikiUtilTest extends TestCase {
030:
031:            /**
032:             *
033:             */
034:            public void testExtractCommentsLink() throws Throwable {
035:                // FIXME
036:                //		String result = WikiUtil.extractCommentsLink("testWikiUtilName");
037:                //		assertEquals("result", "null:testWikiUtilName", result);
038:            }
039:
040:            /**
041:             *
042:             */
043:            public void testExtractTopicLink() throws Throwable {
044:                //TODO
045:                String result = WikiUtil.extractTopicLink("testWikiUtilName");
046:                assertSame("result", "testWikiUtilName", result);
047:            }
048:
049:            /**
050:             *
051:             */
052:            /* FIXME - re-enable
053:            public void testFindRedirectedTopic() throws Throwable {
054:            	Topic parent = new Topic();
055:            	parent.setRedirectTo("testWikiUtilRedirectTo");
056:            	parent.setTopicType(2);
057:            	Topic result = WikiUtil.findRedirectedTopic(parent, 8);
058:            	assertSame("result", parent, result);
059:            }
060:             */
061:
062:            /**
063:             *
064:             */
065:            public void testFindRedirectedTopic1() throws Throwable {
066:                Topic parent = new Topic();
067:                parent.setTopicType(2);
068:                Topic result = WikiUtil.findRedirectedTopic(parent, 100);
069:                assertSame("result", parent, result);
070:            }
071:
072:            /**
073:             *
074:             */
075:            /* FIXME - re-enable
076:            public void testUserHandlerInstance() throws Throwable {
077:            	DatabaseUserHandler result = (DatabaseUserHandler) WikiUtil.userHandlerInstance();
078:            	assertTrue("result.isWriteable()", result.isWriteable());
079:            }
080:             */
081:
082:            /**
083:             *
084:             */
085:            public void testValidateDirectory1() throws Throwable {
086:                WikiMessage result = WikiUtil
087:                        .validateDirectory("testUtilitiesName");
088:                assertEquals("result.getKey()", "error.directoryinvalid",
089:                        result.getKey());
090:            }
091:
092:            /**
093:             *
094:             */
095:            public void testExtractCommentsLinkThrowsException()
096:                    throws Throwable {
097:                try {
098:                    WikiUtil.extractCommentsLink("");
099:                    fail("Expected Exception to be thrown");
100:                } catch (Exception ex) {
101:                    assertEquals("ex.getMessage()", "Empty topic name ", ex
102:                            .getMessage());
103:                }
104:            }
105:
106:            /**
107:             *
108:             */
109:            public void testExtractTopicLinkThrowsException() throws Throwable {
110:                try {
111:                    WikiUtil.extractTopicLink("");
112:                    fail("Expected Exception to be thrown");
113:                } catch (Exception ex) {
114:                    assertEquals("ex.getMessage()", "Empty topic name ", ex
115:                            .getMessage());
116:                }
117:            }
118:
119:            /**
120:             *
121:             */
122:            /* FIXME - re-enable
123:            public void testFindRedirectedTopicThrowsClassNotFoundException() throws Throwable {
124:            	Topic parent = new Topic();
125:            	parent.setRedirectTo("testWikiUtilRedirectTo");
126:            	parent.setTopicType(2);
127:            	parent.setVirtualWiki("testWikiUtilVirtualWiki");
128:            	try {
129:            		WikiUtil.findRedirectedTopic(parent, 8);
130:            		fail("Expected ClassNotFoundException to be thrown");
131:            	} catch (ClassNotFoundException ex) {
132:            		assertTrue("Test completed without Exception", true);
133:            		// dependencies on static and environment state led to removal of 3 assertion(s)
134:            	}
135:            }
136:             */
137:
138:            /**
139:             *
140:             */
141:            public void testReadSpecialPageThrowsFileNotFoundException()
142:                    throws Throwable {
143:                try {
144:                    WikiUtil.readSpecialPage(null, "testWikiUtilPageName");
145:                    fail("Expected FileNotFoundException to be thrown");
146:                } catch (FileNotFoundException ex) {
147:                    assertEquals("ex.getClass()", FileNotFoundException.class,
148:                            ex.getClass());
149:                }
150:            }
151:
152:            /**
153:             *
154:             */
155:            public void testReadSpecialPageThrowsFileNotFoundException1()
156:                    throws Throwable {
157:                try {
158:                    WikiUtil.readSpecialPage(Locale.GERMAN,
159:                            "testWikiUtilPageName");
160:                    fail("Expected FileNotFoundException to be thrown");
161:                } catch (FileNotFoundException ex) {
162:                    assertEquals("ex.getClass()", FileNotFoundException.class,
163:                            ex.getClass());
164:                }
165:            }
166:
167:            /**
168:             *
169:             */
170:            public void testReadSpecialPageThrowsFileNotFoundException2()
171:                    throws Throwable {
172:                try {
173:                    WikiUtil.readSpecialPage(Locale.SIMPLIFIED_CHINESE,
174:                            "testWikiUtilPageName");
175:                    fail("Expected FileNotFoundException to be thrown");
176:                } catch (FileNotFoundException ex) {
177:                    assertEquals("ex.getClass()", FileNotFoundException.class,
178:                            ex.getClass());
179:                }
180:            }
181:
182:            /**
183:             *
184:             */
185:            public void testValidateDirectoryThrowsNullPointerException()
186:                    throws Throwable {
187:                try {
188:                    WikiUtil.validateDirectory(null);
189:                    fail("Expected NullPointerException to be thrown");
190:                } catch (NullPointerException ex) {
191:                    assertNull("ex.getMessage()", ex.getMessage());
192:                }
193:            }
194:
195:            /**
196:             *
197:             */
198:            public void testValidateTopicNameThrowsNullPointerException()
199:                    throws Throwable {
200:                try {
201:                    WikiUtil.validateTopicName(null);
202:                    fail("Expected NullPointerException to be thrown");
203:                } catch (WikiException ex) {
204:                    assertNull("ex.getMessage()", ex.getMessage());
205:                }
206:            }
207:
208:            /**
209:             *
210:             */
211:            public void testValidateTopicNameThrowsWikiException()
212:                    throws Throwable {
213:                try {
214:                    WikiUtil.validateTopicName("");
215:                    fail("Expected WikiException to be thrown");
216:                } catch (WikiException ex) {
217:                    assertNull("ex.getMessage()", ex.getMessage());
218:                    assertEquals("ex.getWikiMessage().getKey()",
219:                            "common.exception.notopic", ex.getWikiMessage()
220:                                    .getKey());
221:                }
222:            }
223:
224:            /**
225:             *
226:             */
227:            /*
228:            public void testValidateTopicNameThrowsWikiException1() throws Throwable {
229:            	try {
230:            		WikiUtil.validateTopicName("testWikiUtil\rName");
231:            		fail("Expected WikiException to be thrown");
232:            	} catch (WikiException ex) {
233:            		assertNull("ex.getMessage()", ex.getMessage());
234:            		assertEquals("ex.getWikiMessage().getKey()", "common.exception.name", ex.getWikiMessage().getKey());
235:            	}
236:            }
237:             */
238:
239:            /**
240:             *
241:             */
242:            public void testValidateUserNameThrowsWikiException()
243:                    throws Throwable {
244:                try {
245:                    WikiUtil.validateUserName("testWikiUtil\rName");
246:                    fail("Expected WikiException to be thrown");
247:                } catch (WikiException ex) {
248:                    assertNull("ex.getMessage()", ex.getMessage());
249:                    assertEquals("ex.getWikiMessage().getKey()",
250:                            "common.exception.name", ex.getWikiMessage()
251:                                    .getKey());
252:                }
253:            }
254:
255:            /**
256:             *
257:             */
258:            public void testValidateUserNameThrowsWikiException1()
259:                    throws Throwable {
260:                try {
261:                    WikiUtil.validateUserName("");
262:                    fail("Expected WikiException to be thrown");
263:                } catch (WikiException ex) {
264:                    assertNull("ex.getMessage()", ex.getMessage());
265:                    assertEquals("ex.getWikiMessage().getKey()",
266:                            "error.loginempty", ex.getWikiMessage().getKey());
267:                }
268:            }
269:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.