|
@ -7,9 +7,6 @@ import org.junit.jupiter.params.provider.Arguments; |
|
|
import org.junit.jupiter.params.provider.MethodSource; |
|
|
import org.junit.jupiter.params.provider.MethodSource; |
|
|
|
|
|
|
|
|
import java.io.ByteArrayInputStream; |
|
|
import java.io.ByteArrayInputStream; |
|
|
import java.io.ByteArrayOutputStream; |
|
|
|
|
|
import java.io.InputStream; |
|
|
|
|
|
import java.nio.charset.StandardCharsets; |
|
|
|
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
|
import java.util.Arrays; |
|
|
import java.util.Arrays; |
|
|
import java.util.Collection; |
|
|
import java.util.Collection; |
|
@ -180,11 +177,8 @@ public class PlayerTest { |
|
|
@ParameterizedTest |
|
|
@ParameterizedTest |
|
|
@MethodSource("checkChooseMethodData") |
|
|
@MethodSource("checkChooseMethodData") |
|
|
void checkChoose(String testName, String input, int expectedResult) { |
|
|
void checkChoose(String testName, String input, int expectedResult) { |
|
|
InputStream stdin = System.in; |
|
|
|
|
|
System.setIn(new ByteArrayInputStream(input.getBytes())); |
|
|
System.setIn(new ByteArrayInputStream(input.getBytes())); |
|
|
|
|
|
|
|
|
int calculatedResult = p.choose(); |
|
|
int calculatedResult = p.choose(); |
|
|
|
|
|
|
|
|
assertThat(calculatedResult).describedAs(testName).isEqualTo(expectedResult); |
|
|
assertThat(calculatedResult).describedAs(testName).isEqualTo(expectedResult); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|