|
|
@ -14,7 +14,7 @@ class MatchfieldCreationTest { |
|
|
|
|
|
|
|
@Test |
|
|
|
void testMatchfieldCreateNotEmpty() { |
|
|
|
MatchfieldCreation matchfield = new MatchfieldCreation(0); |
|
|
|
Matchfield matchfield = new Matchfield(0); |
|
|
|
int[][] calcResult = matchfield.createMatchfield(); |
|
|
|
assertNotNull(calcResult); |
|
|
|
} |
|
|
@ -22,7 +22,7 @@ class MatchfieldCreationTest { |
|
|
|
@ParameterizedTest(name = "matchfield creation has correct size") |
|
|
|
@MethodSource("testMatchfieldSize") |
|
|
|
void testMatchfieldCreationHasCorrectSize(String testName, int size, int expectedResult) { |
|
|
|
MatchfieldCreation matchfield = new MatchfieldCreation(size); |
|
|
|
Matchfield matchfield = new Matchfield(size); |
|
|
|
matchfield.createMatchfield(); |
|
|
|
|
|
|
|
int calcResult = matchfield.getSize(); |
|
|
@ -36,7 +36,7 @@ class MatchfieldCreationTest { |
|
|
|
@ParameterizedTest(name = "matchfield get field is correct") |
|
|
|
@MethodSource("testMatchfieldGetFieldState") |
|
|
|
void testMatchfieldGetCorrectState(String testName, int x, int y, int expectedResult) { |
|
|
|
MatchfieldCreation matchfield = new MatchfieldCreation(10); |
|
|
|
Matchfield matchfield = new Matchfield(10); |
|
|
|
matchfield.createMatchfield(); |
|
|
|
|
|
|
|
int calcResult = matchfield.getState(x, y); |
|
|
@ -44,13 +44,13 @@ class MatchfieldCreationTest { |
|
|
|
} |
|
|
|
|
|
|
|
static Stream<Arguments> testMatchfieldGetFieldState() { |
|
|
|
return Stream.of(Arguments.of("field x:0 y:0 has initial state", 0, 0, 1)); |
|
|
|
return Stream.of(Arguments.of("field x:0 y:0 has empty state", 0, 0, Matchfield.EMPTY)); |
|
|
|
} |
|
|
|
|
|
|
|
@ParameterizedTest(name = "matchfield change field is correct") |
|
|
|
@MethodSource("testMatchfieldSetStateIsCorrect") |
|
|
|
void testMatchfieldGetCorrectState(String testName, int x, int y, int state, int expectedResult) { |
|
|
|
MatchfieldCreation matchfield = new MatchfieldCreation(10); |
|
|
|
Matchfield matchfield = new Matchfield(10); |
|
|
|
matchfield.createMatchfield(); |
|
|
|
|
|
|
|
matchfield.setState(x, y, state); |
|
|
@ -60,6 +60,7 @@ class MatchfieldCreationTest { |
|
|
|
} |
|
|
|
|
|
|
|
static Stream<Arguments> testMatchfieldSetStateIsCorrect() { |
|
|
|
return Stream.of(Arguments.of("field x:0 y:0 has state 2 after setState()", 0, 0, 2, 2)); |
|
|
|
return Stream.of( |
|
|
|
Arguments.of("field x:0 y:0 has state SHIP after setState()", 0, 0, Matchfield.SHIP, Matchfield.SHIP)); |
|
|
|
} |
|
|
|
} |