Source Code Cross Referenced for TestJavadocTaggedNode.java in  » Code-Analyzer » doctorj » org » incava » javadoc » 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 » doctorj » org.incava.javadoc 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.incava.javadoc;
002:
003:        import java.io.*;
004:        import java.util.*;
005:        import junit.framework.TestCase;
006:        import org.incava.text.Location;
007:
008:        public class TestJavadocTaggedNode extends TestCase {
009:            public TestJavadocTaggedNode(String name) {
010:                super (name);
011:            }
012:
013:            public void testTagOnly() {
014:                String text = "@tag";
015:
016:                // starts at line 11, column 4:
017:                Location start = new Location(11, 4);
018:                Location end = new Location(11, 4 + text.length() - 1);
019:                JavadocTaggedNode jtn = new JavadocTaggedNode(text, start, end);
020:
021:                assertNotNull("javadoc tagged node", jtn);
022:                assertEquals("javadoc tagged comment description text", "@tag",
023:                        jtn.text);
024:                assertEquals("javadoc tagged comment start location",
025:                        new Location(11, 4), jtn.start);
026:                assertEquals("javadoc tagged comment end location",
027:                        new Location(11, 7), jtn.end);
028:
029:                assertNotNull("javadoc tagged comment #0 tag", jtn.getTag());
030:                assertEquals("javadoc tagged comment #0 tag text", "@tag", jtn
031:                        .getTag().text);
032:                assertEquals("javadoc tagged comment #0 tag start location",
033:                        new Location(11, 4), jtn.getTag().start);
034:                assertEquals("javadoc tagged comment #0 tag end location",
035:                        new Location(11, 7), jtn.getTag().end);
036:
037:                assertNull("javadoc tagged comment #0 description", jtn
038:                        .getDescription());
039:            }
040:
041:            public void testTagNoFollowingText() {
042:                String text = "@tag ";
043:
044:                // starts at line 11, column 4:
045:                Location start = new Location(11, 4);
046:                Location end = new Location(11, 4 + text.length() - 1);
047:                JavadocTaggedNode jtn = new JavadocTaggedNode(text, start, end);
048:
049:                assertNotNull("javadoc tagged node", jtn);
050:                assertEquals("javadoc tagged comment description text",
051:                        "@tag ", jtn.text);
052:                assertEquals("javadoc tagged comment start location",
053:                        new Location(11, 4), jtn.start);
054:                assertEquals("javadoc tagged comment end location",
055:                        new Location(11, 8), jtn.end);
056:
057:                assertNotNull("javadoc tagged comment #0 tag", jtn.getTag());
058:                assertEquals("javadoc tagged comment #0 tag text", "@tag", jtn
059:                        .getTag().text);
060:                assertEquals("javadoc tagged comment #0 tag start location",
061:                        new Location(11, 4), jtn.getTag().start);
062:                assertEquals("javadoc tagged comment #0 tag end location",
063:                        new Location(11, 7), jtn.getTag().end);
064:
065:                assertNull("javadoc tagged comment #0 description", jtn
066:                        .getDescription());
067:            }
068:
069:            public void testOneLetter() {
070:                String text = "@tag X";
071:
072:                // starts at line 11, column 4:
073:                Location start = new Location(11, 4);
074:                Location end = new Location(11, 4 + text.length() - 1);
075:                JavadocTaggedNode jtn = new JavadocTaggedNode(text, start, end);
076:
077:                assertNotNull("javadoc tagged node", jtn);
078:                assertEquals("javadoc tagged comment description text",
079:                        "@tag X", jtn.text);
080:                assertEquals("javadoc tagged comment start location",
081:                        new Location(11, 4), jtn.start);
082:                assertEquals("javadoc tagged comment end location",
083:                        new Location(11, 9), jtn.end);
084:
085:                assertNotNull("javadoc tagged comment #0 tag", jtn.getTag());
086:                assertEquals("javadoc tagged comment #0 tag text", "@tag", jtn
087:                        .getTag().text);
088:                assertEquals("javadoc tagged comment #0 tag start location",
089:                        new Location(11, 4), jtn.getTag().start);
090:                assertEquals("javadoc tagged comment #0 tag end location",
091:                        new Location(11, 7), jtn.getTag().end);
092:
093:                assertNotNull("javadoc tagged comment #0 description", jtn
094:                        .getDescription());
095:                assertEquals("javadoc tagged comment #0 description text", "X",
096:                        jtn.getDescription().text);
097:                assertEquals(
098:                        "javadoc tagged comment #0 description start location",
099:                        new Location(11, 9), jtn.getDescription().start);
100:                assertEquals(
101:                        "javadoc tagged comment #0 description end location",
102:                        new Location(11, 9), jtn.getDescription().end);
103:            }
104:
105:            public void testOneLine() {
106:                String text = "@tag And that's a tag.";
107:
108:                // starts at line 11, column 4:
109:                Location start = new Location(11, 4);
110:                Location end = new Location(11, 4 + text.length() - 1);
111:                JavadocTaggedNode jtn = new JavadocTaggedNode(text, start, end);
112:
113:                assertNotNull("javadoc tagged node", jtn);
114:                assertEquals("javadoc tagged comment description text",
115:                        "@tag And that's a tag.", jtn.text);
116:                assertEquals("javadoc tagged comment start location",
117:                        new Location(11, 4), jtn.start);
118:                assertEquals("javadoc tagged comment end location",
119:                        new Location(11, 25), jtn.end);
120:
121:                assertNotNull("javadoc tagged comment #0 tag", jtn.getTag());
122:                assertEquals("javadoc tagged comment #0 tag text", "@tag", jtn
123:                        .getTag().text);
124:                assertEquals("javadoc tagged comment #0 tag start location",
125:                        new Location(11, 4), jtn.getTag().start);
126:                assertEquals("javadoc tagged comment #0 tag end location",
127:                        new Location(11, 7), jtn.getTag().end);
128:            }
129:
130:            public void testOneWord() {
131:                String text = "@tag And";
132:
133:                // starts at line 11, column 4:
134:                Location start = new Location(11, 4);
135:                Location end = new Location(11, 4 + text.length() - 1);
136:                JavadocTaggedNode jtn = new JavadocTaggedNode(text, start, end);
137:
138:                assertNotNull("javadoc tagged node", jtn);
139:                assertEquals("javadoc tagged comment description text",
140:                        "@tag And", jtn.text);
141:                assertEquals("javadoc tagged comment start location",
142:                        new Location(11, 4), jtn.start);
143:                assertEquals("javadoc tagged comment end location",
144:                        new Location(11, 11), jtn.end);
145:
146:                assertNotNull("javadoc tagged comment #0 tag", jtn.getTag());
147:                assertEquals("javadoc tagged comment #0 tag text", "@tag", jtn
148:                        .getTag().text);
149:                assertEquals("javadoc tagged comment #0 tag start location",
150:                        new Location(11, 4), jtn.getTag().start);
151:                assertEquals("javadoc tagged comment #0 tag end location",
152:                        new Location(11, 7), jtn.getTag().end);
153:
154:                assertNotNull("javadoc tagged comment #0 description", jtn
155:                        .getDescription());
156:                assertEquals("javadoc tagged comment #0 description text",
157:                        "And", jtn.getDescription().text);
158:                assertEquals(
159:                        "javadoc tagged comment #0 description start location",
160:                        new Location(11, 9), jtn.getDescription().start);
161:                assertEquals(
162:                        "javadoc tagged comment #0 description end location",
163:                        new Location(11, 11), jtn.getDescription().end);
164:            }
165:
166:            public void testWordTarget() {
167:                String text = "@tag And that's a tag.";
168:
169:                // starts at line 11, column 8:
170:                Location start = new Location(11, 8);
171:                Location end = new Location(11, 8 + text.length() - 1);
172:                JavadocTaggedNode jtn = new JavadocTaggedNode(text, start, end);
173:
174:                assertNotNull("javadoc tagged node", jtn);
175:                assertEquals("javadoc tagged comment description text",
176:                        "@tag And that's a tag.", jtn.text);
177:                assertEquals("javadoc tagged comment start location",
178:                        new Location(11, 8), jtn.start);
179:                assertEquals("javadoc tagged comment end location",
180:                        new Location(11, 29), jtn.end);
181:
182:                assertNotNull("javadoc tagged comment #0 tag", jtn.getTag());
183:                assertEquals("javadoc tagged comment #0 tag text", "@tag", jtn
184:                        .getTag().text);
185:                assertEquals("javadoc tagged comment #0 tag start location",
186:                        new Location(11, 8), jtn.getTag().start);
187:                assertEquals("javadoc tagged comment #0 tag end location",
188:                        new Location(11, 11), jtn.getTag().end);
189:
190:                assertNotNull("javadoc tagged comment #0 target", jtn
191:                        .getTarget());
192:                assertEquals("javadoc tagged comment #0 target text", "And",
193:                        jtn.getTarget().text);
194:                assertEquals("javadoc tagged comment #0 target start location",
195:                        new Location(11, 13), jtn.getTarget().start);
196:                assertEquals("javadoc tagged comment #0 target end location",
197:                        new Location(11, 15), jtn.getTarget().end);
198:            }
199:
200:            public void testHTMLTarget() {
201:                String text = "@tag <a href=\"www.somewhere.tld/something/something\">this</a> See that thing for more.";
202:
203:                // starts at line 11, column 8:
204:                Location start = new Location(8, 3);
205:                Location end = new Location(8, 3 + text.length() - 1);
206:                JavadocTaggedNode jtn = new JavadocTaggedNode(text, start, end);
207:
208:                assertNotNull("javadoc tagged node", jtn);
209:                assertEquals("javadoc tagged comment description text", text,
210:                        jtn.text);
211:                assertEquals("javadoc tagged comment start location",
212:                        new Location(8, 3), jtn.start);
213:                assertEquals("javadoc tagged comment end location",
214:                        new Location(8, 88), jtn.end);
215:
216:                assertNotNull("javadoc tagged comment #0 tag", jtn.getTag());
217:                assertEquals("javadoc tagged comment #0 tag text", "@tag", jtn
218:                        .getTag().text);
219:                assertEquals("javadoc tagged comment #0 tag start location",
220:                        new Location(8, 3), jtn.getTag().start);
221:                assertEquals("javadoc tagged comment #0 tag end location",
222:                        new Location(8, 6), jtn.getTag().end);
223:
224:                assertNotNull("javadoc tagged comment #0 target", jtn
225:                        .getTarget());
226:                assertEquals(
227:                        "javadoc tagged comment #0 target text",
228:                        "<a href=\"www.somewhere.tld/something/something\">this</a>",
229:                        jtn.getTarget().text);
230:                assertEquals("javadoc tagged comment #0 target start location",
231:                        new Location(8, 8), jtn.getTarget().start);
232:                assertEquals("javadoc tagged comment #0 target end location",
233:                        new Location(8, 63), jtn.getTarget().end);
234:
235:                assertNotNull("javadoc tagged comment #0 nontarget desc", jtn
236:                        .getDescriptionNonTarget());
237:                assertEquals("javadoc tagged comment #0 nontarget desc text",
238:                        "See that thing for more.", jtn
239:                                .getDescriptionNonTarget().text);
240:                assertEquals(
241:                        "javadoc tagged comment #0 nontarget desc start location",
242:                        new Location(8, 65),
243:                        jtn.getDescriptionNonTarget().start);
244:                assertEquals(
245:                        "javadoc tagged comment #0 nontarget desc end location",
246:                        new Location(8, 88), jtn.getDescriptionNonTarget().end);
247:            }
248:
249:            public void testHTMLTargetUppercase() {
250:                String text = "@tag <A HREF=\"www.somewhere.tld/something/something\">this</A> See that thing for more.";
251:
252:                // starts at line 11, column 8:
253:                Location start = new Location(8, 3);
254:                Location end = new Location(8, 3 + text.length() - 1);
255:                JavadocTaggedNode jtn = new JavadocTaggedNode(text, start, end);
256:
257:                assertNotNull("javadoc tagged node", jtn);
258:                assertEquals("javadoc tagged comment description text", text,
259:                        jtn.text);
260:                assertEquals("javadoc tagged comment start location",
261:                        new Location(8, 3), jtn.start);
262:                assertEquals("javadoc tagged comment end location",
263:                        new Location(8, 88), jtn.end);
264:
265:                assertNotNull("javadoc tagged comment #0 tag", jtn.getTag());
266:                assertEquals("javadoc tagged comment #0 tag text", "@tag", jtn
267:                        .getTag().text);
268:                assertEquals("javadoc tagged comment #0 tag start location",
269:                        new Location(8, 3), jtn.getTag().start);
270:                assertEquals("javadoc tagged comment #0 tag end location",
271:                        new Location(8, 6), jtn.getTag().end);
272:
273:                assertNotNull("javadoc tagged comment #0 target", jtn
274:                        .getTarget());
275:                assertEquals(
276:                        "javadoc tagged comment #0 target text",
277:                        "<A HREF=\"www.somewhere.tld/something/something\">this</A>",
278:                        jtn.getTarget().text);
279:                assertEquals("javadoc tagged comment #0 target start location",
280:                        new Location(8, 8), jtn.getTarget().start);
281:                assertEquals("javadoc tagged comment #0 target end location",
282:                        new Location(8, 63), jtn.getTarget().end);
283:            }
284:
285:            public void testHTMLTargetNoEnd() {
286:                String text = "@tag <A HREF=\"www.somewhere.tld/something/something\">this";
287:
288:                // starts at line 11, column 8:
289:                Location start = new Location(8, 3);
290:                Location end = new Location(8, 3 + text.length() - 1);
291:                JavadocTaggedNode jtn = new JavadocTaggedNode(text, start, end);
292:
293:                assertNotNull("javadoc tagged node", jtn);
294:                assertEquals("javadoc tagged comment description text", text,
295:                        jtn.text);
296:                assertEquals("javadoc tagged comment start location",
297:                        new Location(8, 3), jtn.start);
298:                assertEquals("javadoc tagged comment end location",
299:                        new Location(8, 59), jtn.end);
300:
301:                assertNotNull("javadoc tagged comment #0 tag", jtn.getTag());
302:                assertEquals("javadoc tagged comment #0 tag text", "@tag", jtn
303:                        .getTag().text);
304:                assertEquals("javadoc tagged comment #0 tag start location",
305:                        new Location(8, 3), jtn.getTag().start);
306:                assertEquals("javadoc tagged comment #0 tag end location",
307:                        new Location(8, 6), jtn.getTag().end);
308:
309:                assertNotNull("javadoc tagged comment #0 target", jtn
310:                        .getTarget());
311:                assertEquals(
312:                        "javadoc tagged comment #0 target text",
313:                        "<A HREF=\"www.somewhere.tld/something/something\">this",
314:                        jtn.getTarget().text);
315:                assertEquals("javadoc tagged comment #0 target start location",
316:                        new Location(8, 8), jtn.getTarget().start);
317:                assertEquals("javadoc tagged comment #0 target end location",
318:                        new Location(8, 59), jtn.getTarget().end);
319:            }
320:
321:            public void testQuotedTarget() {
322:                String text = "@tag Something#foo(int, double, float)";
323:
324:                // starts at line 11, column 8:
325:                Location start = new Location(8, 3);
326:                Location end = new Location(8, 3 + text.length() - 1);
327:                JavadocTaggedNode jtn = new JavadocTaggedNode(text, start, end);
328:
329:                assertNotNull("javadoc tagged node", jtn);
330:                assertEquals("javadoc tagged comment description text", text,
331:                        jtn.text);
332:                assertEquals("javadoc tagged comment start location", start,
333:                        jtn.start);
334:                assertEquals("javadoc tagged comment end location", end,
335:                        jtn.end);
336:
337:                assertNotNull("javadoc tagged comment #0 tag", jtn.getTag());
338:                assertEquals("javadoc tagged comment #0 tag text", "@tag", jtn
339:                        .getTag().text);
340:                assertEquals("javadoc tagged comment #0 tag start location",
341:                        start, jtn.getTag().start);
342:                assertEquals("javadoc tagged comment #0 tag end location",
343:                        new Location(start.line, start.column + 3), jtn
344:                                .getTag().end);
345:
346:                assertNotNull("javadoc tagged comment #0 target", jtn
347:                        .getTarget());
348:                assertEquals("javadoc tagged comment #0 target text",
349:                        "Something#foo(int, double, float)",
350:                        jtn.getTarget().text);
351:                assertEquals("javadoc tagged comment #0 target start location",
352:                        new Location(start.line, start.column + 5), jtn
353:                                .getTarget().start);
354:                assertEquals("javadoc tagged comment #0 target end location",
355:                        new Location(start.line, start.column + 5 + 32), jtn
356:                                .getTarget().end);
357:            }
358:
359:            public void testQuotedTargetNoEnd() {
360:                String text = "@tag Something#foo(int, double";
361:
362:                // starts at line 11, column 8:
363:                Location start = new Location(8, 3);
364:                Location end = new Location(8, 3 + text.length() - 1);
365:                JavadocTaggedNode jtn = new JavadocTaggedNode(text, start, end);
366:
367:                assertNotNull("javadoc tagged node", jtn);
368:                assertEquals("javadoc tagged comment description text", text,
369:                        jtn.text);
370:                assertEquals("javadoc tagged comment start location", start,
371:                        jtn.start);
372:                assertEquals("javadoc tagged comment end location", end,
373:                        jtn.end);
374:
375:                assertNotNull("javadoc tagged comment #0 tag", jtn.getTag());
376:                assertEquals("javadoc tagged comment #0 tag text", "@tag", jtn
377:                        .getTag().text);
378:                assertEquals("javadoc tagged comment #0 tag start location",
379:                        start, jtn.getTag().start);
380:                assertEquals("javadoc tagged comment #0 tag end location",
381:                        new Location(start.line, start.column + 3), jtn
382:                                .getTag().end);
383:
384:                assertNotNull("javadoc tagged comment #0 target", jtn
385:                        .getTarget());
386:                assertEquals("javadoc tagged comment #0 target text",
387:                        "Something#foo(int, double", jtn.getTarget().text);
388:                assertEquals("javadoc tagged comment #0 target start location",
389:                        new Location(start.line, start.column + 5), jtn
390:                                .getTarget().start);
391:                assertEquals("javadoc tagged comment #0 target end location",
392:                        new Location(start.line, start.column + 5 + 24), jtn
393:                                .getTarget().end);
394:            }
395:
396:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.