| 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.io.SourceArea; |
| 19 |
|
import org.qedeq.base.io.SourcePosition; |
| 20 |
|
import org.qedeq.base.test.QedeqTestCase; |
| 21 |
|
|
| 22 |
|
|
| 23 |
|
@link |
| 24 |
|
|
| 25 |
|
@author |
| 26 |
|
|
|
|
|
| 95.8% |
Uncovered Elements: 3 (71) |
Complexity: 12 |
Complexity Density: 0.19 |
|
| 27 |
|
public class SourceAreaTest extends QedeqTestCase { |
| 28 |
|
|
| 29 |
|
|
| 30 |
|
private SourceArea object1; |
| 31 |
|
|
| 32 |
|
|
| 33 |
|
private SourceArea object2; |
| 34 |
|
|
| 35 |
|
|
| 36 |
|
private SourceArea object3; |
| 37 |
|
|
| 38 |
|
|
| 39 |
|
private SourceArea object4; |
| 40 |
|
|
| 41 |
|
|
| 42 |
|
private SourceArea object5; |
| 43 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
| 44 |
7
|
protected void setUp() throws Exception {... |
| 45 |
7
|
super.setUp(); |
| 46 |
7
|
object1 = new SourceArea("file:///var/opt/qedeq/001/set_theory_v1.qedeq", |
| 47 |
|
new SourcePosition(12, 17), |
| 48 |
|
new SourcePosition(13, 19) |
| 49 |
|
); |
| 50 |
7
|
object2 = new SourceArea("file:///var/opt/qedeq/001/set_theory_v1.qedeq", |
| 51 |
|
new SourcePosition(12, 17), |
| 52 |
|
new SourcePosition(13, 19) |
| 53 |
|
); |
| 54 |
7
|
object3 = new SourceArea("file:///var/opt/qedeq/001/set_theory_v2.qedeq", |
| 55 |
|
new SourcePosition(12, 17), |
| 56 |
|
new SourcePosition(13, 19) |
| 57 |
|
); |
| 58 |
7
|
object4 = new SourceArea("file:///var/opt/qedeq/001/set_theory_v1.qedeq", |
| 59 |
|
new SourcePosition(13, 17), |
| 60 |
|
new SourcePosition(13, 19) |
| 61 |
|
); |
| 62 |
7
|
object5 = new SourceArea("file:///var/opt/qedeq/001/set_theory_v1.qedeq", |
| 63 |
|
new SourcePosition(12, 19), |
| 64 |
|
new SourcePosition(13, 19) |
| 65 |
|
); |
| 66 |
|
} |
| 67 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 68 |
7
|
protected void tearDown() throws Exception {... |
| 69 |
7
|
super.tearDown(); |
| 70 |
|
} |
| 71 |
|
|
|
|
|
| 66.7% |
Uncovered Elements: 3 (9) |
Complexity: 4 |
Complexity Density: 0.44 |
1
PASS
|
|
| 72 |
1
|
public void testSourceArea() {... |
| 73 |
1
|
try { |
| 74 |
1
|
new SourceArea(null, |
| 75 |
|
new SourcePosition(12, 17), |
| 76 |
|
new SourcePosition(13, 19) |
| 77 |
|
); |
| 78 |
0
|
fail("RuntimeException expected"); |
| 79 |
|
} catch (NullPointerException e) { |
| 80 |
|
|
| 81 |
|
} |
| 82 |
1
|
try { |
| 83 |
1
|
new SourceArea("file:///var/opt/qedeq/001/set_theory_v1.qedeq", |
| 84 |
|
null, |
| 85 |
|
new SourcePosition(13, 19) |
| 86 |
|
); |
| 87 |
0
|
fail("RuntimeException expected"); |
| 88 |
|
} catch (NullPointerException e) { |
| 89 |
|
|
| 90 |
|
} |
| 91 |
1
|
try { |
| 92 |
1
|
new SourceArea("file:///var/opt/qedeq/001/set_theory_v1.qedeq", |
| 93 |
|
new SourcePosition(12, 17), |
| 94 |
|
null |
| 95 |
|
); |
| 96 |
0
|
fail("RuntimeException expected"); |
| 97 |
|
} catch (NullPointerException e) { |
| 98 |
|
|
| 99 |
|
} |
| 100 |
|
} |
| 101 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1
PASS
|
|
| 102 |
1
|
public void testGetAddress() {... |
| 103 |
1
|
assertEquals("file:///var/opt/qedeq/001/set_theory_v1.qedeq", object1.getAddress()); |
| 104 |
1
|
assertEquals("file:///var/opt/qedeq/001/set_theory_v1.qedeq", object2.getAddress()); |
| 105 |
1
|
assertEquals("file:///var/opt/qedeq/001/set_theory_v2.qedeq", object3.getAddress()); |
| 106 |
|
} |
| 107 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1
PASS
|
|
| 108 |
1
|
public void testGetStartPosition() {... |
| 109 |
1
|
assertEquals(new SourcePosition(12, 17), object1.getStartPosition()); |
| 110 |
1
|
assertEquals(new SourcePosition(12, 17), object2.getStartPosition()); |
| 111 |
1
|
assertEquals(new SourcePosition(12, 17), object3.getStartPosition()); |
| 112 |
1
|
assertEquals(new SourcePosition(13, 17), object4.getStartPosition()); |
| 113 |
|
} |
| 114 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1
PASS
|
|
| 115 |
1
|
public void testGetEndPosition() {... |
| 116 |
1
|
assertEquals(new SourcePosition(13, 19), object1.getEndPosition()); |
| 117 |
1
|
assertEquals(new SourcePosition(13, 19), object2.getEndPosition()); |
| 118 |
1
|
assertEquals(new SourcePosition(13, 19), object3.getEndPosition()); |
| 119 |
1
|
assertEquals(new SourcePosition(13, 19), object5.getEndPosition()); |
| 120 |
|
} |
| 121 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1
PASS
|
|
| 122 |
1
|
public void testHashCode() {... |
| 123 |
1
|
assertEquals(object1.hashCode(), object2.hashCode()); |
| 124 |
1
|
assertTrue(object1.hashCode() != object3.hashCode()); |
| 125 |
1
|
assertTrue(object1.hashCode() != object4.hashCode()); |
| 126 |
1
|
assertTrue(object1.hashCode() != object5.hashCode()); |
| 127 |
1
|
assertTrue(object2.hashCode() != object3.hashCode()); |
| 128 |
1
|
assertTrue(object2.hashCode() != object4.hashCode()); |
| 129 |
1
|
assertTrue(object2.hashCode() != object5.hashCode()); |
| 130 |
|
} |
| 131 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (14) |
Complexity: 1 |
Complexity Density: 0.07 |
1
PASS
|
|
| 132 |
1
|
public void testEqualsObject() {... |
| 133 |
1
|
assertEquals(object1, object2); |
| 134 |
1
|
assertEquals(object2, object1); |
| 135 |
1
|
assertTrue(!object1.equals(object3)); |
| 136 |
1
|
assertTrue(!object3.equals(object1)); |
| 137 |
1
|
assertTrue(!object1.equals(object4)); |
| 138 |
1
|
assertTrue(!object4.equals(object1)); |
| 139 |
1
|
assertTrue(!object1.equals(object5)); |
| 140 |
1
|
assertTrue(!object5.equals(object1)); |
| 141 |
1
|
assertTrue(!object2.equals(object3)); |
| 142 |
1
|
assertTrue(!object3.equals(object2)); |
| 143 |
1
|
assertTrue(!object2.equals(object4)); |
| 144 |
1
|
assertTrue(!object4.equals(object2)); |
| 145 |
1
|
assertTrue(!object2.equals(object5)); |
| 146 |
1
|
assertTrue(!object5.equals(object2)); |
| 147 |
|
} |
| 148 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (14) |
Complexity: 1 |
Complexity Density: 0.07 |
1
PASS
|
|
| 149 |
1
|
public void testToString() {... |
| 150 |
1
|
assertEquals(object1.toString(), object2.toString()); |
| 151 |
1
|
assertEquals(object2.toString(), object1.toString()); |
| 152 |
1
|
assertTrue(!object1.toString().equals(object3.toString())); |
| 153 |
1
|
assertTrue(!object3.toString().equals(object1.toString())); |
| 154 |
1
|
assertTrue(!object1.toString().equals(object4.toString())); |
| 155 |
1
|
assertTrue(!object4.toString().equals(object1.toString())); |
| 156 |
1
|
assertTrue(!object1.toString().equals(object5.toString())); |
| 157 |
1
|
assertTrue(!object5.toString().equals(object1.toString())); |
| 158 |
1
|
assertTrue(!object2.toString().equals(object3.toString())); |
| 159 |
1
|
assertTrue(!object3.toString().equals(object2.toString())); |
| 160 |
1
|
assertTrue(!object2.toString().equals(object4.toString())); |
| 161 |
1
|
assertTrue(!object4.toString().equals(object2.toString())); |
| 162 |
1
|
assertTrue(!object2.toString().equals(object5.toString())); |
| 163 |
1
|
assertTrue(!object5.toString().equals(object2.toString())); |
| 164 |
|
} |
| 165 |
|
|
| 166 |
|
} |