File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed
main/java/io/github/benas/unixstream
test/java/io/github/benas/unixstream/components Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -472,4 +472,16 @@ static PrintWriter file(String filePath) throws IOException {
472
472
*/
473
473
void to (final PrintWriter printWriter ) throws IOException ;
474
474
475
+ /*
476
+ * Miscellaneous methods
477
+ */
478
+
479
+ static void rm (final Path path ) {
480
+ try {
481
+ Files .delete (path );
482
+ } catch (IOException e ) {
483
+ throw new RuntimeException ("Unable to delete file " + path .getFileName ());
484
+ }
485
+ }
486
+
475
487
}
Original file line number Diff line number Diff line change
1
+ package io .github .benas .unixstream .components ;
2
+
3
+ import io .github .benas .unixstream .UnixStream ;
4
+ import org .junit .After ;
5
+ import org .junit .Test ;
6
+
7
+ import java .io .IOException ;
8
+ import java .nio .file .Files ;
9
+ import java .nio .file .Path ;
10
+ import java .nio .file .Paths ;
11
+
12
+ import static org .assertj .core .api .Assertions .assertThat ;
13
+
14
+ public class RmTest {
15
+
16
+ private Path foo = Paths .get ("target/foo.txt" );
17
+
18
+ @ Test
19
+ public void rm () throws IOException {
20
+ Files .createFile (foo );
21
+ assertThat (foo ).exists ();
22
+
23
+ UnixStream .rm (foo );
24
+
25
+ assertThat (foo ).doesNotExist ();
26
+ }
27
+
28
+ @ After
29
+ public void tearDown () throws IOException {
30
+ Files .deleteIfExists (foo );
31
+ }
32
+ }
You can’t perform that action at this time.
0 commit comments