From cc784e90945b3cad27dce5eaeaf3b1a385e94a4b Mon Sep 17 00:00:00 2001 From: Julius Dewender Date: Sun, 31 Jan 2021 13:20:33 +0100 Subject: [PATCH] refactored magic numbers --- .../src/test/java/de/fd/fh/GameTest.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/fh.fd.ci.client/src/test/java/de/fd/fh/GameTest.java b/fh.fd.ci.client/src/test/java/de/fd/fh/GameTest.java index 241db7b..271ffdb 100644 --- a/fh.fd.ci.client/src/test/java/de/fd/fh/GameTest.java +++ b/fh.fd.ci.client/src/test/java/de/fd/fh/GameTest.java @@ -73,17 +73,20 @@ class GameTest Game g = new Game(); g.initNewGame(); + int src = Game.whiteRowFarmer * Figure.fieldLength + 0; + int dst = (Game.whiteRowFarmer - 1) * Figure.fieldLength + 0; + // zu bewegende Figur - Figure f = g.mField[Game.whiteRowFarmer * 8 + 0]; + Figure f = g.mField[src]; // Ziel sollte leer sein - assertNull(g.mField[(Game.whiteRowFarmer - 1) * 8 + 0]); + assertNull(g.mField[dst]); // Figur bewegen - assertTrue(g.moveFigure(Game.whiteRowFarmer * 8 + 0, (Game.whiteRowFarmer - 1) * 8 + 0)); + assertTrue(g.moveFigure(src, dst)); // Figur sollte nun verschoben sein - assertNull(g.mField[Game.whiteRowFarmer * 8 + 0]); - assertSame(f, g.mField[(Game.whiteRowFarmer - 1) * 8 + 0]); + assertNull(g.mField[src]); + assertSame(f, g.mField[dst]); } } \ No newline at end of file