DATACMNS-437 - Polishing of newly introduced geo value objects.
Polished JavaDoc. Simplified equals(…) and hashCode() methods where possible. Added additional null checks where appropriate. Removed obsolete generics in Polygon and switched to an immutable collection for the Points making up the Polygon. Added missing toString() method to Polygon. Added test cases for String representations. Related pull request: #68.
This commit is contained in:
committed by
Thomas Darimont
parent
94db475afe
commit
4c5012f637
@@ -52,4 +52,13 @@ public class BoxUnitTests {
|
||||
assertThat(first.hashCode(), is(second.hashCode()));
|
||||
assertThat(first.hashCode(), is(not(third.hashCode())));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-437
|
||||
*/
|
||||
@Test
|
||||
public void testToString() {
|
||||
|
||||
assertThat(first.toString(), is("Box [Point [x=1.000000, y=1.000000], Point [x=2.000000, y=2.000000]]"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,4 +61,13 @@ public class CircleUnitTests {
|
||||
assertThat(left, is(right));
|
||||
assertThat(right, is(left));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-437
|
||||
*/
|
||||
@Test
|
||||
public void testToString() {
|
||||
|
||||
assertThat(new Circle(1, 1, 1).toString(), is("Circle: [center=Point [x=1.000000, y=1.000000], radius=1.0]"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ public class PointUnitTests {
|
||||
*/
|
||||
@Test
|
||||
public void invokingToStringWorksCorrectly() {
|
||||
new Point(1.5, 1.5).toString();
|
||||
assertThat(new Point(1.5, 1.5).toString(), is("Point [x=1.500000, y=1.500000]"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -63,4 +63,14 @@ public class PolygonUnitTests {
|
||||
assertThat(left, is(right));
|
||||
assertThat(right, is(left));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-437
|
||||
*/
|
||||
@Test
|
||||
public void testToString() {
|
||||
|
||||
assertThat(new Polygon(third, second, first).toString(),
|
||||
is("Polygon: [Point [x=3.000000, y=3.000000],Point [x=2.000000, y=2.000000],Point [x=1.000000, y=1.000000]]"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user