Browse Source

optimized annotations

feat-figureMovement
JD 4 years ago
parent
commit
030bed6414
  1. 22
      fh.fd.ci.client/src/test/java/de/fd/fh/GameTest.java

22
fh.fd.ci.client/src/test/java/de/fd/fh/GameTest.java

@ -1,5 +1,7 @@
package de.fd.fh; package de.fd.fh;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
@ -7,12 +9,17 @@ import static org.junit.jupiter.api.Assertions.*;
class GameTest class GameTest
{ {
@Test
void newGameInitializationCorrectField()
private Game g = new Game();
@BeforeEach
void setupTest()
{ {
Game g = new Game();
g.initNewGame(); g.initNewGame();
}
@Test
void newGameInitializationCorrectField()
{
assertEquals(Figure.fieldLength * Figure.fieldLength, g.mField.length); assertEquals(Figure.fieldLength * Figure.fieldLength, g.mField.length);
} }
@ -20,9 +27,6 @@ class GameTest
@Test @Test
void newGameInitializationFigurePositions() void newGameInitializationFigurePositions()
{ {
Game g = new Game();
g.initNewGame();
for (int i = 0; i < Figure.fieldLength; i++) // row for (int i = 0; i < Figure.fieldLength; i++) // row
{ {
for (int j = 0; j < Figure.fieldLength; j++) // col for (int j = 0; j < Figure.fieldLength; j++) // col
@ -45,9 +49,6 @@ class GameTest
@Test @Test
void newGameInitializationFigurePositionsFarmer() void newGameInitializationFigurePositionsFarmer()
{ {
Game g = new Game();
g.initNewGame();
// weiße Bauern // weiße Bauern
for (int j = 0; j < Figure.fieldLength; j++) // col for (int j = 0; j < Figure.fieldLength; j++) // col
{ {
@ -70,9 +71,6 @@ class GameTest
@Test @Test
void moveFarmerWhite() // weißer Bauer ganz links um ein Feld noch vorne bewegen 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 src = Game.whiteRowFarmer * Figure.fieldLength + 0;
int dst = (Game.whiteRowFarmer - 1) * Figure.fieldLength + 0; int dst = (Game.whiteRowFarmer - 1) * Figure.fieldLength + 0;

Loading…
Cancel
Save