1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
package org.qedeq.kernel.se.common; |
17 |
|
|
18 |
|
import org.qedeq.base.io.SourcePosition; |
19 |
|
import org.qedeq.base.test.QedeqTestCase; |
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
|
24 |
|
@author |
25 |
|
|
|
|
| 93% |
Uncovered Elements: 8 (115) |
Complexity: 14 |
Complexity Density: 0.13 |
|
26 |
|
public class ModuleContextTest extends QedeqTestCase { |
27 |
|
|
28 |
|
private ModuleContext con1; |
29 |
|
private ModuleContext con2; |
30 |
|
private ModuleContext con3; |
31 |
|
private ModuleContext con4; |
32 |
|
private ModuleContext con5; |
33 |
|
private ModuleContext con6; |
34 |
|
private ModuleContext con10; |
35 |
|
private ModuleContext con11; |
36 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
37 |
0
|
public ModuleContextTest(){... |
38 |
0
|
super(); |
39 |
|
} |
40 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
41 |
5
|
public ModuleContextTest(final String name){... |
42 |
5
|
super(name); |
43 |
|
} |
44 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 1 |
Complexity Density: 0.11 |
|
45 |
5
|
public void setUp() throws Exception {... |
46 |
5
|
super.setUp(); |
47 |
5
|
this.con1 = new ModuleContext(DefaultModuleAddress.MEMORY); |
48 |
5
|
this.con2 = new ModuleContext(new DefaultModuleAddress(true, "bee")); |
49 |
5
|
this.con3 = new ModuleContext(DefaultModuleAddress.MEMORY, "location!location!"); |
50 |
5
|
this.con4 = new ModuleContext(new DefaultModuleAddress(true, "bee"), "location!location!"); |
51 |
5
|
this.con5 = new ModuleContext(DefaultModuleAddress.MEMORY, ""); |
52 |
5
|
this.con6 = new ModuleContext(new DefaultModuleAddress(true, "bee"), "location!location"); |
53 |
5
|
this.con10 = new ModuleContext(DefaultModuleAddress.MEMORY, "", |
54 |
|
new SourcePosition(1, 1), |
55 |
|
new SourcePosition(1, 2)); |
56 |
5
|
this.con11 = new ModuleContext(con10, "anotherLocation"); |
57 |
|
} |
58 |
|
|
59 |
|
|
60 |
|
|
61 |
|
|
|
|
| 81.8% |
Uncovered Elements: 6 (33) |
Complexity: 7 |
Complexity Density: 0.21 |
1
PASS
|
|
62 |
1
|
public void testConstructor() throws Exception {... |
63 |
1
|
assertEquals(DefaultModuleAddress.MEMORY, con1.getModuleLocation()); |
64 |
1
|
assertEquals("", con1.getLocationWithinModule()); |
65 |
1
|
assertEquals(new DefaultModuleAddress(true, "bee"), con2.getModuleLocation()); |
66 |
1
|
assertEquals("", con2.getLocationWithinModule()); |
67 |
1
|
assertEquals(DefaultModuleAddress.MEMORY, con3.getModuleLocation()); |
68 |
1
|
assertEquals("location!location!", con3.getLocationWithinModule()); |
69 |
1
|
assertEquals(new DefaultModuleAddress(true, "bee"), con4.getModuleLocation()); |
70 |
1
|
assertEquals("location!location!", con4.getLocationWithinModule()); |
71 |
1
|
assertEquals(con1, new ModuleContext(con1)); |
72 |
1
|
assertEquals(con6, new ModuleContext(con6)); |
73 |
1
|
assertEquals("anotherLocation", con11.getLocationWithinModule()); |
74 |
1
|
ModuleContext con51 = new ModuleContext(con5); |
75 |
1
|
assertEquals(con51, con5); |
76 |
1
|
con5.setLocationWithinModule("another location"); |
77 |
1
|
assertFalse(con51.equals(con5)); |
78 |
1
|
try { |
79 |
1
|
new ModuleContext((ModuleAddress) null); |
80 |
0
|
fail("Exception expected"); |
81 |
|
} catch (Exception e) { |
82 |
|
|
83 |
|
} |
84 |
1
|
try { |
85 |
1
|
new ModuleContext((ModuleContext) null); |
86 |
0
|
fail("Exception expected"); |
87 |
|
} catch (Exception e) { |
88 |
|
|
89 |
|
} |
90 |
1
|
try { |
91 |
1
|
new ModuleContext((ModuleContext) null, null); |
92 |
0
|
fail("Exception expected"); |
93 |
|
} catch (Exception e) { |
94 |
|
|
95 |
|
} |
96 |
1
|
try { |
97 |
1
|
new ModuleContext((ModuleAddress) null, null); |
98 |
0
|
fail("Exception expected"); |
99 |
|
} catch (Exception e) { |
100 |
|
|
101 |
|
} |
102 |
1
|
try { |
103 |
1
|
new ModuleContext(this.con1, null); |
104 |
0
|
fail("Exception expected"); |
105 |
|
} catch (Exception e) { |
106 |
|
|
107 |
|
} |
108 |
1
|
try { |
109 |
1
|
new ModuleContext(this.con1.getModuleLocation(), null); |
110 |
0
|
fail("Exception expected"); |
111 |
|
} catch (Exception e) { |
112 |
|
|
113 |
|
} |
114 |
|
} |
115 |
|
|
116 |
|
|
117 |
|
|
118 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
1
PASS
|
|
119 |
1
|
public void testGetDelta() throws Exception {... |
120 |
1
|
assertNull(con1.getStartDelta()); |
121 |
1
|
assertNull(con6.getStartDelta()); |
122 |
1
|
assertNull(con1.getEndDelta()); |
123 |
1
|
assertNull(con5.getEndDelta()); |
124 |
1
|
assertEquals(new SourcePosition(1, 1), con10.getStartDelta()); |
125 |
1
|
assertEquals(new SourcePosition(1, 2), con10.getEndDelta()); |
126 |
|
} |
127 |
|
|
128 |
|
|
129 |
|
|
130 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (21) |
Complexity: 1 |
Complexity Density: 0.05 |
1
PASS
|
|
131 |
1
|
public void testHashCode() throws Exception {... |
132 |
1
|
assertFalse(con1.hashCode() == con2.hashCode()); |
133 |
1
|
assertFalse(con1.hashCode() == con3.hashCode()); |
134 |
1
|
assertFalse(con1.hashCode() == con4.hashCode()); |
135 |
1
|
assertEquals(con1.hashCode(), con5.hashCode()); |
136 |
1
|
assertFalse(con1.hashCode() == con6.hashCode()); |
137 |
1
|
assertFalse(con1.hashCode() == con10.hashCode()); |
138 |
1
|
assertFalse(con2.hashCode() == con3.hashCode()); |
139 |
1
|
assertFalse(con2.hashCode() == con4.hashCode()); |
140 |
1
|
assertFalse(con2.hashCode() == con5.hashCode()); |
141 |
1
|
assertFalse(con2.hashCode() == con6.hashCode()); |
142 |
1
|
assertFalse(con2.hashCode() == con10.hashCode()); |
143 |
1
|
assertFalse(con3.hashCode() == con4.hashCode()); |
144 |
1
|
assertFalse(con3.hashCode() == con5.hashCode()); |
145 |
1
|
assertFalse(con3.hashCode() == con6.hashCode()); |
146 |
1
|
assertFalse(con3.hashCode() == con10.hashCode()); |
147 |
1
|
assertFalse(con4.hashCode() == con5.hashCode()); |
148 |
1
|
assertFalse(con4.hashCode() == con6.hashCode()); |
149 |
1
|
assertFalse(con4.hashCode() == con10.hashCode()); |
150 |
1
|
assertFalse(con5.hashCode() == con6.hashCode()); |
151 |
1
|
assertFalse(con5.hashCode() == con10.hashCode()); |
152 |
1
|
assertFalse(con6.hashCode() == con10.hashCode()); |
153 |
|
} |
154 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (28) |
Complexity: 1 |
Complexity Density: 0.04 |
1
PASS
|
|
155 |
1
|
public void testEqualsObject() throws Exception {... |
156 |
1
|
assertEquals(con1, con1); |
157 |
1
|
assertEquals(con2, con2); |
158 |
1
|
assertEquals(con3, con3); |
159 |
1
|
assertEquals(con4, con4); |
160 |
1
|
assertEquals(con5, con5); |
161 |
1
|
assertEquals(con6, con6); |
162 |
1
|
assertEquals(con10, con10); |
163 |
1
|
assertFalse(con1.equals(null)); |
164 |
1
|
assertFalse(con1.equals(con1.toString())); |
165 |
1
|
assertFalse(con2.equals(null)); |
166 |
1
|
assertFalse(con2.equals(con2.toString())); |
167 |
1
|
assertFalse(con11.equals(null)); |
168 |
1
|
assertFalse(con11.equals(con11.toString())); |
169 |
1
|
assertFalse(con1.equals(con2)); |
170 |
1
|
assertFalse(con1.equals(con3)); |
171 |
1
|
assertFalse(con1.equals(con4)); |
172 |
1
|
assertEquals(con1, con5); |
173 |
1
|
assertFalse(con1.equals(con6)); |
174 |
1
|
assertFalse(con2.equals(con3)); |
175 |
1
|
assertFalse(con2.equals(con4)); |
176 |
1
|
assertFalse(con2.equals(con5)); |
177 |
1
|
assertFalse(con2.equals(con6)); |
178 |
1
|
assertFalse(con3.equals(con4)); |
179 |
1
|
assertFalse(con3.equals(con5)); |
180 |
1
|
assertFalse(con3.equals(con6)); |
181 |
1
|
assertFalse(con4.equals(con5)); |
182 |
1
|
assertFalse(con4.equals(con6)); |
183 |
1
|
assertFalse(con5.equals(con6)); |
184 |
|
} |
185 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
1
PASS
|
|
186 |
1
|
public void testToString() {... |
187 |
1
|
assertEquals("memory://default::null:null", con1.toString()); |
188 |
1
|
assertEquals("memory://bee::null:null", con2.toString()); |
189 |
1
|
assertEquals("memory://default:location!location!:null:null", con3.toString()); |
190 |
1
|
assertEquals("memory://bee:location!location!:null:null", con4.toString()); |
191 |
1
|
assertEquals("memory://default::null:null", con5.toString()); |
192 |
1
|
assertEquals("memory://bee:location!location:null:null", con6.toString()); |
193 |
1
|
assertEquals("memory://default::1:1:1:2", con10.toString()); |
194 |
1
|
assertEquals("memory://default:anotherLocation:null:null", con11.toString()); |
195 |
|
} |
196 |
|
|
197 |
|
} |