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


001:        package org.incava.analysis;
002:
003:        import java.io.*;
004:        import java.util.*;
005:        import junit.framework.TestCase;
006:        import org.incava.qualog.ANSIColor;
007:
008:        public class TestContextReport extends TestCase {
009:            private final static String EOLN = System
010:                    .getProperty("line.separator");
011:
012:            public TestContextReport(String name) {
013:                super (name);
014:            }
015:
016:            public void testReportOrder() {
017:                StringWriter sw;
018:                Report r;
019:
020:                String content = ("As fast as thou shalt wane, so fast thou grow'st\n"
021:                        + "In one of thine, from that which thou departest;\n"
022:                        + "And that fresh blood which youngly thou bestow'st,\r\n"
023:                        + "Thou mayst call thine when thou from youth convertest.\n"
024:                        + "Herein lives wisdom, beauty, and increase;\n"
025:                        + "Without this folly, age, and cold decay:\r"
026:                        + "If all were minded so, the times should cease\r"
027:                        + "And threescore year would make the world away.\n"
028:                        + "Let those whom nature hath not made for store,\n"
029:                        + "Harsh, featureless, and rude, barrenly perish:\n"
030:                        + "Look whom she best endow'd, she gave the more;\n"
031:                        + "Which bounteous gift thou shouldst in bounty cherish:\n"
032:                        + "She carv'd thee for her seal, and meant thereby,\n"
033:                        + "Thou shouldst print more, not let that copy die.\n");
034:
035:                sw = new StringWriter();
036:                r = new ContextReport(sw, content);
037:
038:                r.addViolation(new Violation("msg", 3, 5, 4, 6));
039:                r.addViolation(new Violation("msg2", 5, 3, 6, 4));
040:                assertEquals(2, r.getViolations().size());
041:                r.flush();
042:
043:                String str0 = sw.toString();
044:                tr.Ace.log("str0: " + str0);
045:
046:                sw = new StringWriter();
047:                r = new ContextReport(sw, content);
048:                r.addViolation(new Violation("msg2", 5, 3, 6, 4));
049:                r.addViolation(new Violation("msg", 3, 5, 4, 6));
050:                assertEquals(2, r.getViolations().size());
051:                r.flush();
052:
053:                String str1 = sw.toString();
054:                tr.Ace.log("str1: " + str1);
055:
056:                assertEquals("order of reported violations", str0, str1);
057:            }
058:
059:            public void testSinglePointOutput() {
060:                String content = ("As fast as thou shalt wane, so fast thou grow'st\n"
061:                        + "In one of thine, from that which thou departest;\n"
062:                        + "And that fresh blood which youngly thou bestow'st,\r\n"
063:                        + "Thou mayst call thine when thou from youth convertest.\n"
064:                        + "Herein lives wisdom, beauty, and increase;\n"
065:                        + "Without this folly, age, and cold decay:\r"
066:                        + "If all were minded so, the times should cease\r"
067:                        + "And threescore year would make the world away.\n"
068:                        + "Let those whom nature hath not made for store,\n"
069:                        + "Harsh, featureless, and rude, barrenly perish:\n"
070:                        + "Look whom she best endow'd, she gave the more;\n"
071:                        + "Which bounteous gift thou shouldst in bounty cherish:\n"
072:                        + "She carv'd thee for her seal, and meant thereby,\n"
073:                        + "Thou shouldst print more, not let that copy die.\n");
074:
075:                StringWriter sw = new StringWriter();
076:                Report r = new ContextReport(sw, content);
077:                r.addViolation(new Violation("msg", 5, 9, 5, 9));
078:                assertEquals(1, r.getViolations().size());
079:                r.flush();
080:                String str = sw.toString();
081:                tr.Ace.log("str: " + str);
082:
083:                // end of line gets "fixed" to whatever is appropriate for this system.
084:                assertEquals("In " + ANSIColor.BOLD + ANSIColor.REVERSE + "-"
085:                        + ANSIColor.RESET + ":" + EOLN + EOLN
086:                        + "     5. Herein lives wisdom, beauty, and increase;"
087:                        + EOLN + "                ^" + EOLN + "*** msg" + EOLN
088:                        + EOLN, str);
089:            }
090:
091:            public void testSingleLineOutput() {
092:                String content = ("How heavy do I journey on the way,\n"
093:                        + "When what I seek, my weary travel's end,\n"
094:                        + "Doth teach that ease and that repose to say,\r"
095:                        + "'Thus far the miles are measured from thy friend!'\n"
096:                        + "The beast that bears me, tired with my woe,\r"
097:                        + "Plods dully on, to bear that weight in me,\r\n"
098:                        + "As if by some instinct the wretch did know\r"
099:                        + "His rider lov'd not speed being made from thee.\n"
100:                        + "The bloody spur cannot provoke him on,\n"
101:                        + "That sometimes anger thrusts into his hide,\n"
102:                        + "Which heavily he answers with a groan,\n"
103:                        + "More sharp to me than spurring to his side;\n"
104:                        + "For that same groan doth put this in my mind,\n"
105:                        + "My grief lies onward, and my joy behind.\n");
106:
107:                StringWriter sw = new StringWriter();
108:                Report r = new ContextReport(sw, content);
109:                r.addViolation(new Violation("msg", 10, 16, 10, 20));
110:                assertEquals(1, r.getViolations().size());
111:                r.flush();
112:                String str = sw.toString();
113:                tr.Ace.log("str: " + str);
114:
115:                // end of line gets "fixed" to whatever is appropriate for this system.
116:                assertEquals("In " + ANSIColor.BOLD + ANSIColor.REVERSE + "-"
117:                        + ANSIColor.RESET + ":" + EOLN + EOLN
118:                        + "    10. That sometimes anger thrusts into his hide,"
119:                        + EOLN + "                       <--->" + EOLN
120:                        + "*** msg" + EOLN + EOLN, str);
121:            }
122:
123:            public void testMultiLineOutput() {
124:                String content = ("Against that time, if ever that time come,\n"
125:                        + "When I shall see thee frown on my defects,\r\n"
126:                        + "When as thy love hath cast his utmost sum,\n"
127:                        + "Called to that audit by advis'd respects;\r"
128:                        + "Against that time when thou shalt strangely pass,\n"
129:                        + "And scarcely greet me with that sun, thine eye,\n"
130:                        + "When love, converted from the thing it was,\n"
131:                        + "Shall reasons find of settled gravity;\n"
132:                        + "Against that time do I ensconce me here,\n"
133:                        + "Within the knowledge of mine own desert,\n"
134:                        + "And this my hand, against my self uprear,\n"
135:                        + "To guard the lawful reasons on thy part: \n"
136:                        + "To leave poor me thou hast the strength of laws,\n"
137:                        + "Since why to love I can allege no cause.\n");
138:
139:                StringWriter sw = new StringWriter();
140:                Report r = new ContextReport(sw, content);
141:                r.addViolation(new Violation("msg", 2, 23, 8, 13));
142:                assertEquals(1, r.getViolations().size());
143:                r.flush();
144:                String str = sw.toString();
145:                tr.Ace.log("str: " + str);
146:
147:                // end of line gets "fixed" to whatever is appropriate for this system.
148:                assertEquals(
149:                        "In "
150:                                + ANSIColor.BOLD
151:                                + ANSIColor.REVERSE
152:                                + "-"
153:                                + ANSIColor.RESET
154:                                + ":"
155:                                + EOLN
156:                                + EOLN
157:                                + "                              <-------------------"
158:                                + EOLN
159:                                + "     2. When I shall see thee frown on my defects,"
160:                                + EOLN
161:                                + "     3. When as thy love hath cast his utmost sum,"
162:                                + EOLN
163:                                + "     4. Called to that audit by advis'd respects;"
164:                                + EOLN
165:                                + "     5. Against that time when thou shalt strangely pass,"
166:                                + EOLN
167:                                + "     6. And scarcely greet me with that sun, thine eye,"
168:                                + EOLN
169:                                + "     7. When love, converted from the thing it was,"
170:                                + EOLN
171:                                + "     8. Shall reasons find of settled gravity;"
172:                                + EOLN + "        ------------>" + EOLN
173:                                + "*** msg" + EOLN + EOLN, str);
174:            }
175:
176:            public void testSingleLineWithTabs() {
177:                String content = ("\tMine eye hath play'd the painter and hath steel'd,\n"
178:                        + "\tThy beauty's form in table of my heart;\n"
179:                        + "\tMy body is the frame wherein 'tis held,\n"
180:                        + "\tAnd perspective it is best painter's art.\r"
181:                        + "\tFor through the painter must you see his skill,\n"
182:                        + "\tTo find where your true image pictur'd lies,\n"
183:                        + "\tWhich in my bosom's shop is hanging still,\r"
184:                        + "\tThat hath his windows glazed with thine eyes.\n"
185:                        + "\tNow see what good turns eyes for eyes have done:\n"
186:                        + "\tMine eyes have drawn thy shape, and thine for me\r\n"
187:                        + "\tAre windows to my breast, where-through the sun\n"
188:                        + "\tDelights to peep, to gaze therein on thee; \n"
189:                        + "\tYet eyes this cunning want to grace their art,\n"
190:                        + "\tThey draw but what they see, know not the heart.\n");
191:
192:                StringWriter sw = new StringWriter();
193:                Report r = new ContextReport(sw, content);
194:                r.addViolation(new Violation("msg", 2, 23, 2, 25));
195:                assertEquals(1, r.getViolations().size());
196:                r.flush();
197:                String str = sw.toString();
198:                tr.Ace.log("str: " + str);
199:
200:                assertEquals("In " + ANSIColor.BOLD + ANSIColor.REVERSE + "-"
201:                        + ANSIColor.RESET + ":" + EOLN + EOLN
202:                        + "     2. \tThy beauty's form in table of my heart;"
203:                        + EOLN + "                              <->" + EOLN
204:                        + "*** msg" + EOLN + EOLN, str);
205:            }
206:
207:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.