From 3dbcc09a0982b10e704fa7bc018ccc6ae1717add Mon Sep 17 00:00:00 2001 From: Richard Schmidt <richard.schmidt@mailbox.tu-dresden.de> Date: Tue, 27 Aug 2019 15:07:19 +0200 Subject: [PATCH] Fix unsafe operations --- .../mci/brailleplot/diagrams/BarChartTest.java | 8 ++++---- .../inf/mci/brailleplot/point/Point2DTest.java | 16 ++++++++-------- .../mci/brailleplot/point/Point2DValuedTest.java | 14 +++++++------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/test/java/de/tudresden/inf/mci/brailleplot/diagrams/BarChartTest.java b/src/test/java/de/tudresden/inf/mci/brailleplot/diagrams/BarChartTest.java index b54ea6d6..421dbaa7 100644 --- a/src/test/java/de/tudresden/inf/mci/brailleplot/diagrams/BarChartTest.java +++ b/src/test/java/de/tudresden/inf/mci/brailleplot/diagrams/BarChartTest.java @@ -16,18 +16,18 @@ import java.util.LinkedList; public class BarChartTest { public static SimplePointListContainerImpl container; - public static LinkedList<PointList> outter_list; + public static LinkedList<PointList> outer_list; public static PointList inner_list; public static Point2DDouble point; @BeforeAll public static void initialize() { - outter_list = new LinkedList<>(); + outer_list = new LinkedList<>(); inner_list = new SimplePointListImpl(); point = new Point2DDouble(1, 2); inner_list.pushBack(point); - outter_list.add(inner_list); - container = new SimplePointListContainerImpl(outter_list); + outer_list.add(inner_list); + container = new SimplePointListContainerImpl(outer_list); } @Test diff --git a/src/test/java/de/tudresden/inf/mci/brailleplot/point/Point2DTest.java b/src/test/java/de/tudresden/inf/mci/brailleplot/point/Point2DTest.java index 464ecdc3..54e43609 100644 --- a/src/test/java/de/tudresden/inf/mci/brailleplot/point/Point2DTest.java +++ b/src/test/java/de/tudresden/inf/mci/brailleplot/point/Point2DTest.java @@ -12,22 +12,22 @@ public class Point2DTest { public void testPoint2D () { int a = 1; int b = 2; - Point2D p; + Point2D<Integer> p; - Assertions.assertThrows(NullPointerException.class, () -> {new Point2D(null, b);}); - Assertions.assertThrows(NullPointerException.class, () -> {new Point2D(a, null);}); + Assertions.assertThrows(NullPointerException.class, () -> {new Point2D<>(null, b);}); + 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(b, p.getY()); } @Test public void testEquals () { - Point2DDouble point_1 = new Point2DDouble(1, 2); - Point2DDouble point_2 = new Point2DDouble(1, 2); - Point2DDouble point_3 = new Point2DDouble(1, 3); - Point2DDouble point_4 = new Point2DDouble(2, 2); + Point2D<Integer> point_1 = new Point2D<>(1, 2); + Point2D<Integer> point_2 = new Point2D<>(1, 2); + Point2D<Integer> point_3 = new Point2D<>(1, 3); + Point2D<Integer> point_4 = new Point2D<>(2, 2); String string = "test"; Assertions.assertEquals(true, point_1.equals(point_2)); diff --git a/src/test/java/de/tudresden/inf/mci/brailleplot/point/Point2DValuedTest.java b/src/test/java/de/tudresden/inf/mci/brailleplot/point/Point2DValuedTest.java index f9070797..5d6a225e 100644 --- a/src/test/java/de/tudresden/inf/mci/brailleplot/point/Point2DValuedTest.java +++ b/src/test/java/de/tudresden/inf/mci/brailleplot/point/Point2DValuedTest.java @@ -14,19 +14,19 @@ public class Point2DValuedTest { int b = 2; 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()); } @Test public void testEquals () { - Point2DValued<Integer, Integer> point_1 = 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_4 = new Point2DValued(1, 1, 3); - Point2DValued<Integer, Integer> point_5 = new Point2DValued(1, 2, 2); + Point2DValued<Integer, Integer> point_1 = 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_4 = new Point2DValued<>(1, 1, 3); + Point2DValued<Integer, Integer> point_5 = new Point2DValued<>(1, 2, 2); String string = "test"; Assertions.assertEquals(true, point_1.equals(point_2)); -- GitLab