Skip to content

Commit d76a132

Browse files
committed
Use JUnit 5 convention for test method visibility
1 parent 1089c11 commit d76a132

File tree

213 files changed

+1753
-1753
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

213 files changed

+1753
-1753
lines changed

src/test/java/org/apache/commons/compress/ArchiveReadTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ protected String getExpectedString(final ArchiveEntry entry) {
8989

9090
@ParameterizedTest
9191
@MethodSource("data")
92-
public void testArchive(final File file) throws Exception {
92+
void testArchive(final File file) throws Exception {
9393
@SuppressWarnings("unchecked") // fileList is correct type already
9494
final ArrayList<String> expected = (ArrayList<String>) FILE_LIST.clone();
9595
assertDoesNotThrow(() -> checkArchiveContent(file, expected), "Problem checking " + file);

src/test/java/org/apache/commons/compress/ArchiveUtilsTest.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ private void asciiToByteAndBackOK(final String inputString) {
5252
}
5353

5454
@Test
55-
public void testAsciiConversions() {
55+
void testAsciiConversions() {
5656
asciiToByteAndBackOK("");
5757
asciiToByteAndBackOK("abcd");
5858
asciiToByteAndBackFail("\u8025");
5959
}
6060

6161
@Test
62-
public void testCompareAscii() {
62+
void testCompareAscii() {
6363
final byte[] buffer1 = { 'a', 'b', 'c' };
6464
final byte[] buffer2 = { 'd', 'e', 'f', 0 };
6565
assertTrue(ArchiveUtils.matchAsciiBuffer("abc", buffer1));
@@ -69,7 +69,7 @@ public void testCompareAscii() {
6969
}
7070

7171
@Test
72-
public void testCompareBA() {
72+
void testCompareBA() {
7373
final byte[] buffer1 = { 1, 2, 3 };
7474
final byte[] buffer2 = { 1, 2, 3, 0 };
7575
final byte[] buffer3 = { 1, 2, 3 };
@@ -84,32 +84,32 @@ public void testCompareBA() {
8484
}
8585

8686
@Test
87-
public void testIsEqual() {
87+
void testIsEqual() {
8888
assertTrue(ArchiveUtils.isEqual(null, 0, 0, null, 0, 0));
8989
}
9090

9191
@Test
92-
public void testIsEqualWithNullWithPositive() {
92+
void testIsEqualWithNullWithPositive() {
9393
final byte[] byteArray = new byte[8];
9494
byteArray[1] = (byte) -77;
9595
assertFalse(ArchiveUtils.isEqualWithNull(byteArray, 0, (byte) 0, byteArray, (byte) 0, (byte) 80));
9696
}
9797

9898
@Test
99-
public void testSanitizeLeavesShortStringsAlone() {
99+
void testSanitizeLeavesShortStringsAlone() {
100100
final String input = "012345678901234567890123456789012345678901234567890123456789";
101101
assertEquals(input, ArchiveUtils.sanitize(input));
102102
}
103103

104104
@Test
105-
public void testSanitizeRemovesUnprintableCharacters() {
105+
void testSanitizeRemovesUnprintableCharacters() {
106106
final String input = "\b12345678901234567890123456789012345678901234567890123456789";
107107
final String expected = "?12345678901234567890123456789012345678901234567890123456789";
108108
assertEquals(expected, ArchiveUtils.sanitize(input));
109109
}
110110

111111
@Test
112-
public void testSanitizeShortensString() {
112+
void testSanitizeShortensString() {
113113
// @formatter:off
114114
final String input = "012345678901234567890123456789012345678901234567890123456789"
115115
+ "012345678901234567890123456789012345678901234567890123456789"
@@ -126,20 +126,20 @@ public void testSanitizeShortensString() {
126126
}
127127

128128
@Test
129-
public void testToAsciiBytes() {
129+
void testToAsciiBytes() {
130130
final byte[] byteArray = ArchiveUtils.toAsciiBytes("SOCKET");
131131
assertArrayEquals(new byte[] { (byte) 83, (byte) 79, (byte) 67, (byte) 75, (byte) 69, (byte) 84 }, byteArray);
132132
assertFalse(ArchiveUtils.isEqualWithNull(byteArray, 0, 46, byteArray, 63, 0));
133133
}
134134

135135
@Test
136-
public void testToAsciiStringThrowsStringIndexOutOfBoundsException() {
136+
void testToAsciiStringThrowsStringIndexOutOfBoundsException() {
137137
final byte[] byteArray = new byte[3];
138138
assertThrows(StringIndexOutOfBoundsException.class, () -> ArchiveUtils.toAsciiString(byteArray, 940, 2730));
139139
}
140140

141141
@Test
142-
public void testToStringWithNonNull() {
142+
void testToStringWithNonNull() {
143143
final SevenZArchiveEntry sevenZArchiveEntry = new SevenZArchiveEntry();
144144
final String string = ArchiveUtils.toString(sevenZArchiveEntry);
145145
assertEquals("- 0 null", string);

src/test/java/org/apache/commons/compress/ChainingTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
public class ChainingTest extends AbstractTest {
3333

3434
@Test
35-
public void testTarBzip2() throws Exception {
35+
void testTarBzip2() throws Exception {
3636
try (TarArchiveInputStream is = new TarArchiveInputStream(new BZip2CompressorInputStream(newInputStream("bla.tar.bz2")))) {
3737
final TarArchiveEntry entry = is.getNextEntry();
3838
assertNotNull(entry);
@@ -42,7 +42,7 @@ public void testTarBzip2() throws Exception {
4242
}
4343

4444
@Test
45-
public void testTarGzip() throws Exception {
45+
void testTarGzip() throws Exception {
4646
try (TarArchiveInputStream is = new TarArchiveInputStream(new GzipCompressorInputStream(newInputStream("bla.tgz")))) {
4747
final TarArchiveEntry entry = is.getNextEntry();
4848
assertNotNull(entry);

src/test/java/org/apache/commons/compress/DetectArchiverTest.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,23 +86,23 @@ private boolean isValidName(final String value) {
8686
}
8787

8888
@Test
89-
public void testCOMPRESS_117() throws Exception {
89+
void testCOMPRESS_117() throws Exception {
9090
try (ArchiveInputStream<?> tar = createArchiveInputStream("COMPRESS-117.tar")) {
9191
assertNotNull(tar);
9292
assertInstanceOf(TarArchiveInputStream.class, tar);
9393
}
9494
}
9595

9696
@Test
97-
public void testCOMPRESS_335() throws Exception {
97+
void testCOMPRESS_335() throws Exception {
9898
try (ArchiveInputStream<?> tar = createArchiveInputStream("COMPRESS-335.tar")) {
9999
assertNotNull(tar);
100100
assertInstanceOf(TarArchiveInputStream.class, tar);
101101
}
102102
}
103103

104104
@Test
105-
public void testDetection() throws Exception {
105+
void testDetection() throws Exception {
106106

107107
try (ArchiveInputStream<?> ar = createArchiveInputStream("bla.ar")) {
108108
assertNotNull(ar);
@@ -144,50 +144,50 @@ public void testDetection() throws Exception {
144144
// Check that the empty archives created by the code are readable
145145

146146
// Not possible to detect empty "ar" archive as it is completely empty
147-
// public void testEmptyArArchive() throws Exception {
147+
// void testEmptyArArchive() throws Exception {
148148
// emptyArchive("ar");
149149
// }
150150

151151
@Test
152-
public void testDetectionNotArchive() {
152+
void testDetectionNotArchive() {
153153
assertThrows(ArchiveException.class, () -> createArchiveInputStream("test.txt"));
154154
}
155155

156156
@Test
157-
public void testDetectOldTarFormatArchive() throws Exception {
157+
void testDetectOldTarFormatArchive() throws Exception {
158158
try (ArchiveInputStream<?> tar = createArchiveInputStream("COMPRESS-612/test-times-star-folder.tar")) {
159159
assertNotNull(tar);
160160
assertInstanceOf(TarArchiveInputStream.class, tar);
161161
}
162162
}
163163

164164
@Test
165-
public void testEmptyCpioArchive() throws Exception {
165+
void testEmptyCpioArchive() throws Exception {
166166
checkEmptyArchive("cpio");
167167
}
168168

169169
@Test
170-
public void testEmptyJarArchive() throws Exception {
170+
void testEmptyJarArchive() throws Exception {
171171
checkEmptyArchive("jar");
172172
}
173173

174174
@Test
175-
public void testEmptyTarArchive() throws Exception {
175+
void testEmptyTarArchive() throws Exception {
176176
// Can't detect empty tar archive from its contents.
177177
final Path path = createEmptyArchive("tar"); // will be deleted by tearDown()
178178
assertThrows(ArchiveException.class, () -> checkDetectedType("tar", path));
179179
}
180180

181181
@Test
182-
public void testEmptyZipArchive() throws Exception {
182+
void testEmptyZipArchive() throws Exception {
183183
checkEmptyArchive("zip");
184184
}
185185

186186
/**
187187
* Tests COMPRESS-644.
188188
*/
189189
@Test
190-
public void testIcoFile() {
190+
void testIcoFile() {
191191
assertThrows(ArchiveException.class, () -> {
192192
try (InputStream in = createBufferedInputStream("org/apache/commons/compress/COMPRESS-644/ARW05UP.ICO")) {
193193
assertNull(ArchiveStreamFactory.detect(in));
@@ -196,7 +196,7 @@ public void testIcoFile() {
196196
}
197197

198198
@Test
199-
public void testIcoFileFirstTarArchiveEntry() throws Exception {
199+
void testIcoFileFirstTarArchiveEntry() throws Exception {
200200
try (TarArchiveInputStream inputStream = new TarArchiveInputStream(createBufferedInputStream("org/apache/commons/compress/COMPRESS-644/ARW05UP.ICO"))) {
201201
final TarArchiveEntry entry = inputStream.getNextEntry();
202202
// Find hints that the file is not a TAR file.

src/test/java/org/apache/commons/compress/IOMethodsTest.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -138,56 +138,56 @@ private void compareWrites(final String archiverName, final ArchiveEntry entry)
138138
}
139139

140140
@Test
141-
public void testReadAr() throws Exception {
141+
void testReadAr() throws Exception {
142142
compareReads("ar");
143143
}
144144

145145
@Test
146-
public void testReadCpio() throws Exception {
146+
void testReadCpio() throws Exception {
147147
compareReads("cpio");
148148
}
149149

150150
@Test
151-
public void testReadJar() throws Exception {
151+
void testReadJar() throws Exception {
152152
compareReads("jar");
153153
}
154154

155155
@Test
156-
public void testReadTar() throws Exception {
156+
void testReadTar() throws Exception {
157157
compareReads("tar");
158158
}
159159

160160
@Test
161-
public void testReadZip() throws Exception {
161+
void testReadZip() throws Exception {
162162
compareReads("zip");
163163
}
164164

165165
@Test
166-
public void testWriteAr() throws Exception {
166+
void testWriteAr() throws Exception {
167167
compareWrites("ar", new ArArchiveEntry("dummy", bytesToTest));
168168
}
169169

170170
@Test
171-
public void testWriteCpio() throws Exception {
171+
void testWriteCpio() throws Exception {
172172
final ArchiveEntry entry = new CpioArchiveEntry("dummy", bytesToTest);
173173
compareWrites("cpio", entry);
174174
}
175175

176176
@Test
177-
public void testWriteJar() throws Exception {
177+
void testWriteJar() throws Exception {
178178
final ArchiveEntry entry = new JarArchiveEntry("dummy");
179179
compareWrites("jar", entry);
180180
}
181181

182182
@Test
183-
public void testWriteTar() throws Exception {
183+
void testWriteTar() throws Exception {
184184
final TarArchiveEntry entry = new TarArchiveEntry("dummy");
185185
entry.setSize(bytesToTest);
186186
compareWrites("tar", entry);
187187
}
188188

189189
@Test
190-
public void testWriteZip() throws Exception {
190+
void testWriteZip() throws Exception {
191191
final ArchiveEntry entry = new ZipArchiveEntry("dummy");
192192
compareWrites("zip", entry);
193193
}

src/test/java/org/apache/commons/compress/MemoryLimitExceptionTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
public class MemoryLimitExceptionTest {
3333

3434
@Test
35-
public void testAccessorsCause() {
35+
void testAccessorsCause() {
3636
final IOException ioe = new IOException();
3737
final MemoryLimitException e = new MemoryLimitException(1, 2, (Throwable) ioe);
3838
assertEquals(1, e.getMemoryNeededInKb());
@@ -41,7 +41,7 @@ public void testAccessorsCause() {
4141
}
4242

4343
@Test
44-
public void testAccessorsCauseDepreacted() {
44+
void testAccessorsCauseDepreacted() {
4545
final IOException ioe = new IOException();
4646
@SuppressWarnings("deprecation")
4747
final MemoryLimitException e = new MemoryLimitException(1, 2, ioe);
@@ -51,7 +51,7 @@ public void testAccessorsCauseDepreacted() {
5151
}
5252

5353
@Test
54-
public void testAccessorsLimit() {
54+
void testAccessorsLimit() {
5555
final MemoryLimitException e = new MemoryLimitException(1, 2);
5656
assertEquals(1, e.getMemoryNeededInKb());
5757
assertEquals(2, e.getMemoryLimitInKb());

src/test/java/org/apache/commons/compress/archivers/ArTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
public final class ArTest extends AbstractTest {
4242

4343
@Test
44-
public void testArArchiveCreation() throws Exception {
44+
void testArArchiveCreation() throws Exception {
4545
final File output = newTempFile("bla.ar");
4646

4747
final File file1 = getFile("test1.xml");
@@ -61,7 +61,7 @@ public void testArArchiveCreation() throws Exception {
6161
}
6262

6363
@Test
64-
public void testArDelete() throws Exception {
64+
void testArDelete() throws Exception {
6565
final File output = newTempFile("bla.ar");
6666

6767
final File file1 = getFile("test1.xml");
@@ -140,7 +140,7 @@ public void testArDelete() throws Exception {
140140
}
141141

142142
@Test
143-
public void testArUnarchive() throws Exception {
143+
void testArUnarchive() throws Exception {
144144
final File output = newTempFile("bla.ar");
145145
{
146146
final File file1 = getFile("test1.xml");
@@ -169,7 +169,7 @@ public void testArUnarchive() throws Exception {
169169
}
170170

171171
@Test
172-
public void testExplicitFileEntry() throws Exception {
172+
void testExplicitFileEntry() throws Exception {
173173
final File file = createTempFile();
174174
final File archive = createTempFile("test.", ".ar");
175175
try (ArArchiveOutputStream aos = new ArArchiveOutputStream(Files.newOutputStream(archive.toPath()))) {
@@ -191,7 +191,7 @@ public void testExplicitFileEntry() throws Exception {
191191
}
192192

193193
@Test
194-
public void testFileEntryFromFile() throws Exception {
194+
void testFileEntryFromFile() throws Exception {
195195
final File file = createTempFile();
196196
final File archive = createTempFile("test.", ".ar");
197197
try (ArArchiveOutputStream aos = new ArArchiveOutputStream(Files.newOutputStream(archive.toPath()))) {
@@ -213,7 +213,7 @@ public void testFileEntryFromFile() throws Exception {
213213
}
214214

215215
@Test
216-
public void testFileEntryFromPath() throws Exception {
216+
void testFileEntryFromPath() throws Exception {
217217
final File file = createTempFile();
218218
final File archive = createTempFile("test.", ".ar");
219219
try (ArArchiveOutputStream aos = new ArArchiveOutputStream(Files.newOutputStream(archive.toPath()))) {
@@ -237,7 +237,7 @@ public void testFileEntryFromPath() throws Exception {
237237
// TODO: revisit - does AR not support storing directories?
238238
@Disabled
239239
@Test
240-
public void testXtestDirectoryEntryFromFile() throws Exception {
240+
void testXtestDirectoryEntryFromFile() throws Exception {
241241
final File tmp = createTempFile();
242242
final File archive = createTempFile("test.", ".ar");
243243
final long beforeArchiveWrite;
@@ -262,7 +262,7 @@ public void testXtestDirectoryEntryFromFile() throws Exception {
262262
// TODO: revisit - does AR not support storing directories?
263263
@Disabled
264264
@Test
265-
public void testXtestExplicitDirectoryEntry() throws Exception {
265+
void testXtestExplicitDirectoryEntry() throws Exception {
266266
final File tmp = createTempFile();
267267
final File archive = createTempFile("test.", ".ar");
268268
final long beforeArchiveWrite;

0 commit comments

Comments
 (0)