Browse Source

refactored test whiteFarmerValidDestination to ParameterizedTest

feat-figureMovement
JD 4 years ago
parent
commit
0bda50fef8
  1. 14
      fh.fd.ci.client/src/test/java/de/fd/fh/FigureFarmerTest.java

14
fh.fd.ci.client/src/test/java/de/fd/fh/FigureFarmerTest.java

@ -1,6 +1,8 @@
package de.fd.fh; package de.fd.fh;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assertions.*;
@ -9,11 +11,15 @@ class FigureFarmerTest
Figure[] field = new Figure[Figure.fieldLength * Figure.fieldLength]; Figure[] field = new Figure[Figure.fieldLength * Figure.fieldLength];
// weißer Bauer // weißer Bauer
@Test
void whiteFarmerValidDestination()
@ParameterizedTest
// row (src), col (src), row (dst), col (dst)
@CsvSource({
"6, 0, 5, 0" // a2 -> a3
})
void whiteFarmerValidDestination(int srcRow, int srcCol, int dstRow, int dstCol)
{ {
int src = Figure.fieldLength * 6 + 0;
int dst = Figure.fieldLength * 5 + 0;
int src = Figure.fieldLength * srcRow + srcCol;
int dst = Figure.fieldLength * dstRow + dstCol;
Figure f = new FigureFarmer(FigureFarmer.Color.White); Figure f = new FigureFarmer(FigureFarmer.Color.White);
assertTrue(f.moveAllowed(src, dst, field)); assertTrue(f.moveAllowed(src, dst, field));

Loading…
Cancel
Save