Skip to content
Snippets Groups Projects
Commit 3dbcc09a authored by Richard Schmidt's avatar Richard Schmidt
Browse files

Fix unsafe operations

parent 44520368
No related branches found
No related tags found
1 merge request!18Feat/csvparser tests
...@@ -16,18 +16,18 @@ import java.util.LinkedList; ...@@ -16,18 +16,18 @@ import java.util.LinkedList;
public class BarChartTest { public class BarChartTest {
public static SimplePointListContainerImpl container; public static SimplePointListContainerImpl container;
public static LinkedList<PointList> outter_list; public static LinkedList<PointList> outer_list;
public static PointList inner_list; public static PointList inner_list;
public static Point2DDouble point; public static Point2DDouble point;
@BeforeAll @BeforeAll
public static void initialize() { public static void initialize() {
outter_list = new LinkedList<>(); outer_list = new LinkedList<>();
inner_list = new SimplePointListImpl(); inner_list = new SimplePointListImpl();
point = new Point2DDouble(1, 2); point = new Point2DDouble(1, 2);
inner_list.pushBack(point); inner_list.pushBack(point);
outter_list.add(inner_list); outer_list.add(inner_list);
container = new SimplePointListContainerImpl(outter_list); container = new SimplePointListContainerImpl(outer_list);
} }
@Test @Test
......
...@@ -12,22 +12,22 @@ public class Point2DTest { ...@@ -12,22 +12,22 @@ public class Point2DTest {
public void testPoint2D () { public void testPoint2D () {
int a = 1; int a = 1;
int b = 2; int b = 2;
Point2D p; Point2D<Integer> p;
Assertions.assertThrows(NullPointerException.class, () -> {new Point2D(null, b);}); Assertions.assertThrows(NullPointerException.class, () -> {new Point2D<>(null, b);});
Assertions.assertThrows(NullPointerException.class, () -> {new Point2D(a, null);}); Assertions.assertThrows(NullPointerException.class, () -> {new Point2D<>(a, null);});
p = new Point2D(a, b); p = new Point2D<>(a, b);
Assertions.assertEquals(a, p.getX()); Assertions.assertEquals(a, p.getX());
Assertions.assertEquals(b, p.getY()); Assertions.assertEquals(b, p.getY());
} }
@Test @Test
public void testEquals () { public void testEquals () {
Point2DDouble point_1 = new Point2DDouble(1, 2); Point2D<Integer> point_1 = new Point2D<>(1, 2);
Point2DDouble point_2 = new Point2DDouble(1, 2); Point2D<Integer> point_2 = new Point2D<>(1, 2);
Point2DDouble point_3 = new Point2DDouble(1, 3); Point2D<Integer> point_3 = new Point2D<>(1, 3);
Point2DDouble point_4 = new Point2DDouble(2, 2); Point2D<Integer> point_4 = new Point2D<>(2, 2);
String string = "test"; String string = "test";
Assertions.assertEquals(true, point_1.equals(point_2)); Assertions.assertEquals(true, point_1.equals(point_2));
......
...@@ -14,19 +14,19 @@ public class Point2DValuedTest { ...@@ -14,19 +14,19 @@ public class Point2DValuedTest {
int b = 2; int b = 2;
int value = 3; int value = 3;
Assertions.assertThrows(NullPointerException.class, () -> {new Point2DValued(a, b, null);}); Assertions.assertThrows(NullPointerException.class, () -> {new Point2DValued<Integer, Integer>(a, b, null);});
Point2DValued<Integer, Integer> point = new Point2DValued(a, b, value); Point2DValued<Integer, Integer> point = new Point2DValued<>(a, b, value);
Assertions.assertEquals(value, point.getVal()); Assertions.assertEquals(value, point.getVal());
} }
@Test @Test
public void testEquals () { public void testEquals () {
Point2DValued<Integer, Integer> point_1 = new Point2DValued(1, 2, 3); Point2DValued<Integer, Integer> point_1 = new Point2DValued<>(1, 2, 3);
Point2DValued<Integer, Integer> point_2 = new Point2DValued(1, 2, 3); Point2DValued<Integer, Integer> point_2 = new Point2DValued<>(1, 2, 3);
Point2DValued<Integer, Integer> point_3 = new Point2DValued(2, 2, 3); Point2DValued<Integer, Integer> point_3 = new Point2DValued<>(2, 2, 3);
Point2DValued<Integer, Integer> point_4 = new Point2DValued(1, 1, 3); Point2DValued<Integer, Integer> point_4 = new Point2DValued<>(1, 1, 3);
Point2DValued<Integer, Integer> point_5 = new Point2DValued(1, 2, 2); Point2DValued<Integer, Integer> point_5 = new Point2DValued<>(1, 2, 2);
String string = "test"; String string = "test";
Assertions.assertEquals(true, point_1.equals(point_2)); Assertions.assertEquals(true, point_1.equals(point_2));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment