Use BufferedReader.lines()

Closes gh-11436
This commit is contained in:
Johnny Lim
2017-12-27 14:36:38 +09:00
committed by Stephane Nicoll
parent 50a4982a52
commit 8f7ab95e0e
6 changed files with 19 additions and 57 deletions

View File

@@ -29,6 +29,7 @@ import java.util.List;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import org.junit.Assume;
import org.junit.rules.TestRule;
@@ -192,12 +193,7 @@ public class CliTester implements TestRule {
InputStream stream = URI.create("http://localhost:" + port + uri).toURL()
.openStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
String line;
StringBuilder result = new StringBuilder();
while ((line = reader.readLine()) != null) {
result.append(line);
}
return result.toString();
return reader.lines().collect(Collectors.joining());
}
catch (Exception ex) {
throw new IllegalStateException(ex);