Update ReadInputCharByCharUnitTest.java

This commit is contained in:
Ana Peterlic 2024-02-05 20:24:52 +01:00
parent 7ec4a9fd1d
commit 1899d70e91
1 changed files with 8 additions and 2 deletions

View File

@ -2,7 +2,13 @@ package com.baeldung.readinputcharbychar;
import org.junit.jupiter.api.Test;
import java.io.*;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import static org.junit.Assert.assertArrayEquals;
@ -51,7 +57,7 @@ public class ReadInputCharByCharUnitTest {
System.setIn(inputStream);
try (Scanner scanner = new Scanner(System.in)) {
while (scanner.hasNext()) {
if (scanner.hasNext()) {
char[] result = scanner.next().toCharArray();
assertArrayEquals("TestInput".toCharArray(), result);
}