Skip to content

Commit 2a5d548

Browse files
author
eugenp
committed
java io work
1 parent 3fd3475 commit 2a5d548

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,16 @@ public void whenAppendStringUsingBufferedWritter_thenOldContentShouldExistToo()
5252
}
5353

5454
@Test
55-
public void whenWriteFormattedStringUsingPrintWriter_thenOutputShouldBeFormatted() throws IOException {
55+
public void givenWritingStringToFile_whenUsingPrintWriter_thenCorrect() throws IOException {
5656
final FileWriter fileWriter = new FileWriter(fileName);
5757
final PrintWriter printWriter = new PrintWriter(fileWriter);
58+
printWriter.print("Some String");
5859
printWriter.printf("Product name is %s and its price is %d $", "iPhone", 1000);
5960
printWriter.close();
6061
}
6162

6263
@Test
63-
public void whenWriteStringUsingFileOutputStream_thenCorrect() throws IOException {
64+
public void givenWritingStringToFile_whenUsingFileOutputStream_thenCorrect() throws IOException {
6465
final String str = "Hello";
6566
final FileOutputStream outputStream = new FileOutputStream(fileName3);
6667
final byte[] strToBytes = str.getBytes();

0 commit comments

Comments
 (0)