From b69624400045c9f5f7a5bc8799a30890fd3aaf4c Mon Sep 17 00:00:00 2001 From: Max Wenzel Date: Wed, 12 Jan 2022 13:13:32 +0100 Subject: [PATCH] Coodrdinates returns correct Values for X and Y --- .../fleetstorm/matchfield/Coordinate.java | 20 +++++++++++++++++++ .../fleetstorm/matchfield/CoordinateTest.java | 20 +++++++++++++++++++ .../matchfield/MatchfieldCreationTest.java | 2 +- 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 src/main/java/de/tims/fleetstorm/matchfield/Coordinate.java create mode 100644 src/test/java/de/tims/fleetstorm/matchfield/CoordinateTest.java diff --git a/src/main/java/de/tims/fleetstorm/matchfield/Coordinate.java b/src/main/java/de/tims/fleetstorm/matchfield/Coordinate.java new file mode 100644 index 0000000..a084376 --- /dev/null +++ b/src/main/java/de/tims/fleetstorm/matchfield/Coordinate.java @@ -0,0 +1,20 @@ +package de.tims.fleetstorm.matchfield; + +public class Coordinate { + private int x; + private int y; + + public Coordinate(int x, int y) { + this.x = x; + this.y = y; + } + + public Integer getX() { + return x; + } + + public Integer getY() { + return y; + } + +} diff --git a/src/test/java/de/tims/fleetstorm/matchfield/CoordinateTest.java b/src/test/java/de/tims/fleetstorm/matchfield/CoordinateTest.java new file mode 100644 index 0000000..75b87af --- /dev/null +++ b/src/test/java/de/tims/fleetstorm/matchfield/CoordinateTest.java @@ -0,0 +1,20 @@ +package de.tims.fleetstorm.matchfield; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.junit.jupiter.api.Test; + +class CoordinateTest { + + int x = 1; + int y = 3; + + Coordinate coordinate = new Coordinate(x, y); + + @Test + void testGetCorrectValuesForXY() { + assertEquals(coordinate.getX(), x); + assertEquals(coordinate.getY(), y); + } + +} diff --git a/src/test/java/de/tims/fleetstorm/matchfield/MatchfieldCreationTest.java b/src/test/java/de/tims/fleetstorm/matchfield/MatchfieldCreationTest.java index 168dade..d885970 100644 --- a/src/test/java/de/tims/fleetstorm/matchfield/MatchfieldCreationTest.java +++ b/src/test/java/de/tims/fleetstorm/matchfield/MatchfieldCreationTest.java @@ -1,7 +1,7 @@ package de.tims.fleetstorm.matchfield; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNotNull; import java.util.stream.Stream;