Skip to content

Commit 83c8040

Browse files
authored
BAEL-4661: Add an example of creating a file using FileOutputStream (eugenp#10131)
1 parent 0704ee4 commit 83c8040

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

core-java-modules/core-java-io-3/src/test/java/com/baeldung/createfile/CreateFileUnitTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import org.junit.jupiter.api.Test;
77

88
import java.io.File;
9+
import java.io.FileOutputStream;
910
import java.io.IOException;
1011
import java.nio.file.Files;
1112
import java.nio.file.Path;
@@ -37,6 +38,12 @@ public void givenUsingFile_whenCreatingFile_thenCorrect() throws IOException {
3738
assertTrue(success);
3839
}
3940

41+
@Test
42+
void givenUsingFileOutputStream_whenCreatingFile_thenCorrect() throws IOException {
43+
try(FileOutputStream fileOutputStream = new FileOutputStream(FILE_NAME)){
44+
}
45+
}
46+
4047
@Test
4148
public void givenUsingGuava_whenCreatingFile_thenCorrect() throws IOException {
4249
com.google.common.io.Files.touch(new File(FILE_NAME));

0 commit comments

Comments
 (0)