Skip to content

Commit cbd92a8

Browse files
author
eugenp
committed
cleanup IO work
1 parent c1e7dc0 commit cbd92a8

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

core-java/src/test/java/org/baeldung/java/io/JavaReaderToXUnitTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class JavaReaderToXUnitTest {
3434

3535
@Test
3636
public void givenUsingPlainJava_whenConvertingReaderIntoStringV1_thenCorrect() throws IOException {
37-
final StringReader reader = new StringReader("With Java 1");
37+
final Reader reader = new StringReader("With Java 1");
3838
int intValueOfChar;
3939
String targetString = "";
4040
while ((intValueOfChar = reader.read()) != -1) {
@@ -73,10 +73,9 @@ public void givenUsingCommonsIO_whenConvertingReaderIntoString_thenCorrect() thr
7373
// tests - Reader WRITE TO File
7474

7575
@Test
76-
public void givenUsingPlainJava_whenConvertingReaderIntoFile_thenCorrect() throws IOException {
76+
public void givenUsingPlainJava_whenWritingReaderContentsToFile_thenCorrect() throws IOException {
7777
final File sourceFile = new File("src/test/resources/sourceFile.txt");
7878
sourceFile.createNewFile();
79-
8079
final Reader initialReader = new FileReader(sourceFile);
8180
final char[] buffer = new char[(int) sourceFile.length()];
8281
initialReader.read(buffer);
@@ -91,8 +90,9 @@ public void givenUsingPlainJava_whenConvertingReaderIntoFile_thenCorrect() throw
9190
}
9291

9392
@Test
94-
public void givenUsingGuava_whenConvertingReaderIntoFile_thenCorrect() throws IOException {
93+
public void givenUsingGuava_whenWritingReaderContentsToFile_thenCorrect() throws IOException {
9594
final Reader initialReader = CharSource.wrap("IDDQD").openStream();
95+
9696
final File targetFile = new File("src/test/resources/targetFile.txt");
9797
com.google.common.io.Files.touch(targetFile);
9898
final CharSink charSink = com.google.common.io.Files.asCharSink(targetFile, Charset.defaultCharset(), FileWriteMode.APPEND);
@@ -101,7 +101,7 @@ public void givenUsingGuava_whenConvertingReaderIntoFile_thenCorrect() throws IO
101101
}
102102

103103
@Test
104-
public void givenUsingCommonsIO_whenConvertingReaderIntoFile_thenCorrect() throws IOException {
104+
public void givenUsingCommonsIO_whenWritingReaderContentsToFile_thenCorrect() throws IOException {
105105
final Reader initialReader = new CharSequenceReader("CharSequenceReader extends Reader");
106106
final File targetFile = new File("src/test/resources/targetFile.txt");
107107
FileUtils.touch(targetFile);

0 commit comments

Comments
 (0)