Browse Source

Refactor choose Method

AIPlayer
Jonas Wagner 3 years ago
parent
commit
fb39982e6e
  1. 1
      src/main/java/Player.java
  2. 6
      src/test/java/PlayerTest.java

1
src/main/java/Player.java

@ -1,4 +1,3 @@
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Scanner;

6
src/test/java/PlayerTest.java

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

Loading…
Cancel
Save