|
|
@ -1,8 +1,14 @@ |
|
|
|
package de.tims.fleetstorm.matchfield; |
|
|
|
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat; |
|
|
|
import static org.junit.Assert.assertNotNull; |
|
|
|
|
|
|
|
import java.util.stream.Stream; |
|
|
|
|
|
|
|
import org.junit.jupiter.api.Test; |
|
|
|
import org.junit.jupiter.params.ParameterizedTest; |
|
|
|
import org.junit.jupiter.params.provider.Arguments; |
|
|
|
import org.junit.jupiter.params.provider.MethodSource; |
|
|
|
|
|
|
|
class MatchfieldCreationTest { |
|
|
|
|
|
|
@ -10,7 +16,19 @@ class MatchfieldCreationTest { |
|
|
|
|
|
|
|
@Test |
|
|
|
void testMatchfieldCreateNotEmpty() { |
|
|
|
int[][] calcResult = matchfield.createMatchfield(); |
|
|
|
int[][] calcResult = matchfield.createMatchfield(0); |
|
|
|
assertNotNull(calcResult); |
|
|
|
} |
|
|
|
|
|
|
|
@ParameterizedTest(name = "matchfield creation has correct size") |
|
|
|
@MethodSource("testMatchfieldSize") |
|
|
|
void testMatchfieldCreationHasCorrectSize(String testName, int size, int expectedResult) { |
|
|
|
matchfield.createMatchfield(size); |
|
|
|
int calcResult = matchfield.getSize(); |
|
|
|
assertThat(calcResult).describedAs(testName).isEqualTo(expectedResult); |
|
|
|
} |
|
|
|
|
|
|
|
static Stream<Arguments> testMatchfieldSize() { |
|
|
|
return Stream.of(Arguments.of("field size 10x10", 10, 10)); |
|
|
|
} |
|
|
|
} |