31
31
* @run junit/othervm ExtractFilesTest
32
32
*/
33
33
34
- import org .junit .jupiter .api .AfterAll ;
35
- import org .junit .jupiter .api .Assertions ;
36
- import org .junit .jupiter .api .BeforeAll ;
37
- import org .junit .jupiter .api .Test ;
38
- import org .junit .jupiter .api .TestInstance ;
39
- import org .junit .jupiter .api .TestInstance .Lifecycle ;
34
+ import org .junit .*;
40
35
41
36
import java .io .ByteArrayOutputStream ;
42
37
import java .io .IOException ;
51
46
import jdk .testlibrary .FileUtils ;
52
47
import sun .tools .jar .Main ;
53
48
54
- @ TestInstance (Lifecycle .PER_CLASS )
55
49
public class ExtractFilesTest {
56
50
private final String nl = System .lineSeparator ();
57
51
private final ByteArrayOutputStream baos = new ByteArrayOutputStream ();
58
52
private final PrintStream out = new PrintStream (baos );
59
53
60
- @ BeforeAll
54
+ @ Before
61
55
public void setupJar () throws IOException {
62
56
mkdir ("test1 test2" );
63
57
echo ("testfile1" , "test1/testfile1" );
@@ -66,7 +60,7 @@ public void setupJar() throws IOException {
66
60
rm ("test1 test2" );
67
61
}
68
62
69
- @ AfterAll
63
+ @ After
70
64
public void cleanup () {
71
65
rm ("test.jar" );
72
66
}
@@ -83,7 +77,7 @@ public void testExtract() throws IOException {
83
77
" inflated: testfile1" + nl +
84
78
" inflated: testfile2" + nl ;
85
79
rm ("META-INF testfile1 testfile2" );
86
- Assertions .assertArrayEquals (baos .toByteArray (), output .getBytes ());
80
+ Assert .assertArrayEquals (baos .toByteArray (), output .getBytes ());
87
81
}
88
82
89
83
/**
@@ -98,9 +92,9 @@ public void testOverwrite() throws IOException {
98
92
" inflated: META-INF/MANIFEST.MF" + nl +
99
93
" inflated: testfile1" + nl +
100
94
" inflated: testfile2" + nl ;
101
- Assertions .assertEquals ("testfile1" , cat ("testfile1" ));
95
+ Assert .assertEquals ("testfile1" , cat ("testfile1" ));
102
96
rm ("META-INF testfile1 testfile2" );
103
- Assertions .assertArrayEquals (baos .toByteArray (), output .getBytes ());
97
+ Assert .assertArrayEquals (baos .toByteArray (), output .getBytes ());
104
98
}
105
99
106
100
/**
@@ -115,10 +109,10 @@ public void testKeptOldFile() throws IOException {
115
109
" inflated: META-INF/MANIFEST.MF" + nl +
116
110
" skipped: testfile1 exists" + nl +
117
111
" inflated: testfile2" + nl ;
118
- Assertions .assertEquals ("" , cat ("testfile1" ));
119
- Assertions .assertEquals ("testfile2" , cat ("testfile2" ));
112
+ Assert .assertEquals ("" , cat ("testfile1" ));
113
+ Assert .assertEquals ("testfile2" , cat ("testfile2" ));
120
114
rm ("META-INF testfile1 testfile2" );
121
- Assertions .assertArrayEquals (baos .toByteArray (), output .getBytes ());
115
+ Assert .assertArrayEquals (baos .toByteArray (), output .getBytes ());
122
116
}
123
117
124
118
/**
@@ -133,10 +127,10 @@ public void testGnuOptionsKeptOldFile() throws IOException {
133
127
" inflated: META-INF/MANIFEST.MF" + nl +
134
128
" skipped: testfile1 exists" + nl +
135
129
" skipped: testfile2 exists" + nl ;
136
- Assertions .assertEquals ("" , cat ("testfile1" ));
137
- Assertions .assertEquals ("" , cat ("testfile2" ));
130
+ Assert .assertEquals ("" , cat ("testfile1" ));
131
+ Assert .assertEquals ("" , cat ("testfile2" ));
138
132
rm ("META-INF testfile1 testfile2" );
139
- Assertions .assertArrayEquals (baos .toByteArray (), output .getBytes ());
133
+ Assert .assertArrayEquals (baos .toByteArray (), output .getBytes ());
140
134
}
141
135
142
136
/**
@@ -152,8 +146,8 @@ public void testWarningOnInvalidKeepOption() throws IOException {
152
146
"testfile1" + nl +
153
147
"testfile2" + nl ;
154
148
155
- Assertions .assertArrayEquals (baos .toByteArray (), output .getBytes ());
156
- Assertions .assertEquals ("Warning: The k option is not valid with current usage, will be ignored." + nl , err );
149
+ Assert .assertArrayEquals (baos .toByteArray (), output .getBytes ());
150
+ Assert .assertEquals ("Warning: The k option is not valid with current usage, will be ignored." + nl , err );
157
151
}
158
152
159
153
private Stream <Path > mkpath (String ... args ) {
0 commit comments