1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
package org.qedeq.base.io; |
17 |
|
|
18 |
|
import org.qedeq.base.test.QedeqTestCase; |
19 |
|
import org.qedeq.base.utility.StringUtility; |
20 |
|
|
21 |
|
|
22 |
|
@link |
23 |
|
|
24 |
|
@author |
25 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (70) |
Complexity: 5 |
Complexity Density: 0.08 |
|
26 |
|
public class StringOutputTest extends QedeqTestCase { |
27 |
|
|
28 |
|
private static final String XML_DATA = |
29 |
|
"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" |
30 |
|
+ "<QEDEQ \n" |
31 |
|
+ " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" |
32 |
|
+ " xsi:noNamespaceSchemaLocation=\"http://www.qedeq.org/0_01_06/xml/qedeq.xsd\">\n" |
33 |
|
+ " <HEADER email=\"mime@qedeq.org\">\n" |
34 |
|
+ " <SPEC name=\"qedeq_sample1\" ruleVersion=\"1.00.00\">\n" |
35 |
|
+ " <LOCATIONS>\n" |
36 |
|
+ " \t\r <LOCATION value=\"http://qedeq.org/0.01.06/sample1\"/>\n" |
37 |
|
+ " </LOCATIONS>\n" |
38 |
|
+ " </SPEC>\n" |
39 |
|
+ " <TITLE>\n" |
40 |
|
+ " <LATEX language=\"en\">\n" |
41 |
|
+ " Example1\n" |
42 |
|
+ " </LATEX>\n" |
43 |
|
+ " </TITLE>\n" |
44 |
|
+ " <ABSTRACT>\n" |
45 |
|
+ " <LATEX language=\"en\">\n" |
46 |
|
+ " 1789.01239In this very first qedeq module the XML specification is demonstrated.\n" |
47 |
|
+ " </LATEX>\n" |
48 |
|
+ " </ABSTRACT>\n" |
49 |
|
+ " <AUTHORS>\n" |
50 |
|
+ " <AUTHOR email=\"michael@meyling.com\">\n" |
51 |
|
+ " <LATEX language=\"de\">\n" |
52 |
|
+ " <![CDATA[Michael Meyling]]>\n" |
53 |
|
+ " </LATEX>\n" |
54 |
|
+ " </AUTHOR>\n" |
55 |
|
+ " </AUTHORS>\n" |
56 |
|
+ " </HEADER>\n" |
57 |
|
+ "</QEDEQ>\n"; |
58 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
59 |
3
|
protected void setUp() throws Exception {... |
60 |
3
|
super.setUp(); |
61 |
|
} |
62 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
63 |
3
|
protected void tearDown() throws Exception {... |
64 |
3
|
super.tearDown(); |
65 |
|
} |
66 |
|
|
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
@throws |
71 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (54) |
Complexity: 1 |
Complexity Density: 0.02 |
1
PASS
|
|
72 |
1
|
public void testComplete() throws Exception {... |
73 |
1
|
final AbstractOutput out = new StringOutput(); |
74 |
1
|
out.println("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>"); |
75 |
1
|
out.println("<QEDEQ "); |
76 |
1
|
out.pushLevel(); |
77 |
1
|
out.pushLevel(); |
78 |
1
|
out.print("xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""); |
79 |
1
|
out.println(); |
80 |
1
|
out.println("xsi:noNamespaceSchemaLocation=\"http://www.qedeq.org/0_01_06/xml/qedeq.xsd\">"); |
81 |
1
|
out.popLevel(); |
82 |
1
|
out.println("<HEADER email=\"mime@qedeq.org\">"); |
83 |
1
|
out.pushLevel(); |
84 |
1
|
out.print("<SPEC name=\"qedeq_sample1\" ruleVersion=\"1.00.00\">"); |
85 |
1
|
out.print("\n"); |
86 |
1
|
out.pushLevel(); |
87 |
1
|
out.println("<LOCATIONS>"); |
88 |
1
|
out.print((Object) ("\t\r <LOCATION value=\"http://qedeq.org/0.01.06/sample1\"/>" |
89 |
|
+ "\n")); |
90 |
1
|
out.println("</LOCATIONS>"); |
91 |
1
|
out.popLevel(); |
92 |
1
|
out.println("</SPEC>"); |
93 |
1
|
out.println("<TITLE>"); |
94 |
1
|
out.pushLevel(); |
95 |
1
|
out.println("<LATEX language=\"en\">"); |
96 |
1
|
out.println(" Example1"); |
97 |
1
|
out.println("</LATEX>"); |
98 |
1
|
out.popLevel(); |
99 |
1
|
out.println("</TITLE>"); |
100 |
1
|
out.println("<ABSTRACT>"); |
101 |
1
|
out.pushLevel(); |
102 |
1
|
out.println("<LATEX language=\"en\">"); |
103 |
1
|
out.pushLevel(); |
104 |
1
|
out.println(" 1789.01239In this very first qedeq module the XML specification is demonstrated."); |
105 |
1
|
out.popLevel(); |
106 |
1
|
out.println("</LATEX>"); |
107 |
1
|
out.popLevel(); |
108 |
1
|
out.println("</ABSTRACT>"); |
109 |
1
|
out.println("<AUTHORS>"); |
110 |
1
|
out.pushLevel(); |
111 |
1
|
out.println("<AUTHOR email=\"michael@meyling.com\">"); |
112 |
1
|
out.pushLevel(); |
113 |
1
|
out.println("<LATEX language=\"de\">"); |
114 |
1
|
out.pushLevel(); |
115 |
1
|
out.println(" <![CDATA[Michael Meyling]]>"); |
116 |
1
|
out.popLevel(); |
117 |
1
|
out.println("</LATEX>"); |
118 |
1
|
out.popLevel(); |
119 |
1
|
out.println("</AUTHOR>"); |
120 |
1
|
out.popLevel(); |
121 |
1
|
out.println("</AUTHORS>"); |
122 |
1
|
out.println((Object) " </HEADER>"); |
123 |
1
|
out.pushLevel(); |
124 |
1
|
out.clearLevel(); |
125 |
1
|
out.println("</QEDEQ>"); |
126 |
|
|
127 |
1
|
assertEquals(StringUtility.string2Hex(XML_DATA), |
128 |
|
StringUtility.byte2Hex(out.toString().getBytes())); |
129 |
|
|
130 |
1
|
assertEquals(XML_DATA, out.toString()); |
131 |
|
|
132 |
|
|
133 |
|
} |
134 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1
PASS
|
|
135 |
1
|
public void testGetPosition() {... |
136 |
1
|
final AbstractOutput out = new StringOutput(); |
137 |
1
|
out.pushLevel(); |
138 |
1
|
out.print("James Bond"); |
139 |
1
|
assertEquals(" James Bond".length(), out.getPosition()); |
140 |
|
} |
141 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1
PASS
|
|
142 |
1
|
public void testPushPop() throws Exception {... |
143 |
1
|
final AbstractOutput out = new StringOutput(); |
144 |
1
|
out.popLevel(); |
145 |
1
|
out.popLevel(); |
146 |
1
|
out.print("James Bond"); |
147 |
1
|
assertEquals("James Bond", out.toString()); |
148 |
|
} |
149 |
|
|
150 |
|
} |
151 |
|
|