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