From 030bed6414a852207d2d604bf2a3dcaae0a35306 Mon Sep 17 00:00:00 2001 From: Julius Dewender Date: Sun, 31 Jan 2021 13:26:57 +0100 Subject: [PATCH] optimized annotations --- .../src/test/java/de/fd/fh/GameTest.java | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 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 271ffdb..b77bcb5 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 @@ -1,5 +1,7 @@ package de.fd.fh; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import static org.hamcrest.MatcherAssert.assertThat; @@ -7,12 +9,17 @@ import static org.junit.jupiter.api.Assertions.*; class GameTest { - @Test - void newGameInitializationCorrectField() + private Game g = new Game(); + + @BeforeEach + void setupTest() { - Game g = new Game(); g.initNewGame(); + } + @Test + void newGameInitializationCorrectField() + { assertEquals(Figure.fieldLength * Figure.fieldLength, g.mField.length); } @@ -20,9 +27,6 @@ class GameTest @Test void newGameInitializationFigurePositions() { - Game g = new Game(); - g.initNewGame(); - for (int i = 0; i < Figure.fieldLength; i++) // row { for (int j = 0; j < Figure.fieldLength; j++) // col @@ -45,9 +49,6 @@ class GameTest @Test void newGameInitializationFigurePositionsFarmer() { - Game g = new Game(); - g.initNewGame(); - // weiße Bauern for (int j = 0; j < Figure.fieldLength; j++) // col { @@ -70,9 +71,6 @@ class GameTest @Test void moveFarmerWhite() // weißer Bauer ganz links um ein Feld noch vorne bewegen { - Game g = new Game(); - g.initNewGame(); - int src = Game.whiteRowFarmer * Figure.fieldLength + 0; int dst = (Game.whiteRowFarmer - 1) * Figure.fieldLength + 0;