Update givenInputFromConsole_whenUsingScanner_thenReadCharByChar

This commit is contained in:
Ana Peterlic 2024-02-03 06:37:14 +01:00
parent c1fd4cc7dc
commit 7ec4a9fd1d
1 changed files with 4 additions and 3 deletions

View File

@ -51,9 +51,10 @@ public class ReadInputCharByCharUnitTest {
System.setIn(inputStream); System.setIn(inputStream);
try (Scanner scanner = new Scanner(System.in)) { try (Scanner scanner = new Scanner(System.in)) {
char[] result = scanner.next().toCharArray(); while (scanner.hasNext()) {
char[] result = scanner.next().toCharArray();
assertArrayEquals("TestInput".toCharArray(), result); assertArrayEquals("TestInput".toCharArray(), result);
}
} }
} }
} }