JavaInputStreamToXUnitTest refactor
This commit is contained in:
parent
bf71b3442b
commit
924b960746
|
@ -36,7 +36,7 @@ public class JavaInputStreamToXUnitTest {
|
|||
|
||||
final StringBuilder textBuilder = new StringBuilder();
|
||||
try (Reader reader = new BufferedReader(new InputStreamReader(inputStream, Charset.forName(StandardCharsets.UTF_8.name())))) {
|
||||
int c = 0;
|
||||
int c;
|
||||
while ((c = reader.read()) != -1) {
|
||||
textBuilder.append((char) c);
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ public class JavaInputStreamToXUnitTest {
|
|||
final InputStream inputStream = new ByteArrayInputStream(originalString.getBytes()); // exampleString.getBytes(StandardCharsets.UTF_8);
|
||||
|
||||
// When
|
||||
String text = null;
|
||||
String text;
|
||||
try (Scanner scanner = new Scanner(inputStream, StandardCharsets.UTF_8.name())) {
|
||||
text = scanner.useDelimiter("\\A").next();
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ public class JavaInputStreamToXUnitTest {
|
|||
final InputStream inputStream = new ByteArrayInputStream(originalString.getBytes());
|
||||
|
||||
// When
|
||||
String text = null;
|
||||
String text;
|
||||
try (final Reader reader = new InputStreamReader(inputStream)) {
|
||||
text = CharStreams.toString(reader);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue