From 28819ca78fdc18bbfbd9a372c7c928589f17e43c Mon Sep 17 00:00:00 2001 From: Julius Dewender Date: Thu, 14 Jan 2021 22:35:19 +0100 Subject: [PATCH] refactored farmer --- .../src/main/java/de/fd/fh/FigureFarmer.java | 10 ++++++++++ fh.fd.ci.client/src/test/java/de/fd/fh/FigureTest.java | 10 +++++----- 2 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 fh.fd.ci.client/src/main/java/de/fd/fh/FigureFarmer.java diff --git a/fh.fd.ci.client/src/main/java/de/fd/fh/FigureFarmer.java b/fh.fd.ci.client/src/main/java/de/fd/fh/FigureFarmer.java new file mode 100644 index 0000000..45830f3 --- /dev/null +++ b/fh.fd.ci.client/src/main/java/de/fd/fh/FigureFarmer.java @@ -0,0 +1,10 @@ +package de.fd.fh; + +public class FigureFarmer extends Figure +{ + @Override + public boolean moveAllowed(int src, int dst, int[] field) + { + return super.moveAllowed(src, dst, field); + } +} diff --git a/fh.fd.ci.client/src/test/java/de/fd/fh/FigureTest.java b/fh.fd.ci.client/src/test/java/de/fd/fh/FigureTest.java index 8c040ec..2be91bb 100644 --- a/fh.fd.ci.client/src/test/java/de/fd/fh/FigureTest.java +++ b/fh.fd.ci.client/src/test/java/de/fd/fh/FigureTest.java @@ -38,35 +38,35 @@ class FigureTest @Test void checkMoveWithValidDestination() { - Figure f = new Figure(); + Figure f = new FigureFarmer(); assertTrue(f.moveAllowed(Figure.fieldLength * 6 + 0, Figure.fieldLength * 5 + 0, new int[Figure.fieldLength * Figure.fieldLength])); } @Test void whiteFarmerInvalidDestinationDown() // statt nach "oben" wird nach "unten" gegangen { - Figure f = new Figure(); + Figure f = new FigureFarmer(); assertFalse(f.moveAllowed(Figure.fieldLength * 6 + 0, Figure.fieldLength * 7 + 0, new int[Figure.fieldLength * Figure.fieldLength])); } @Test void whiteFarmerInvalidDestinationUp() // mehr als 1 Schritt nach "oben" { - Figure f = new Figure(); + Figure f = new FigureFarmer(); assertFalse(f.moveAllowed(Figure.fieldLength * 6 + 0, Figure.fieldLength * 4 + 0, new int[Figure.fieldLength * Figure.fieldLength])); } @Test void checkMoveWithValidDestinationVar2() // Bauer (w) steht in der Mitte vom Feld und geht 1 nach oben { - Figure f = new Figure(); + Figure f = new FigureFarmer(); assertTrue(f.moveAllowed(Figure.fieldLength * 4 + 4, Figure.fieldLength * 3 + 4, new int[Figure.fieldLength * Figure.fieldLength])); } @Test void whiteFarmerInvalidDestinationDownVar2() // Bauer (w) steht in der Mitte vom Feld und geht 1 nach unten { - Figure f = new Figure(); + Figure f = new FigureFarmer(); assertFalse(f.moveAllowed(Figure.fieldLength * 4 + 4, Figure.fieldLength * 5 + 4, new int[Figure.fieldLength * Figure.fieldLength])); } } \ No newline at end of file