You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2026/04/05 13:29:23 UTC
(commons-compress) branch master updated: Use static imports only for JUnit
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git
The following commit(s) were added to refs/heads/master by this push:
new ac5866f0c Use static imports only for JUnit
ac5866f0c is described below
commit ac5866f0c3b9f9f165630c4439090682212d6392
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Apr 5 09:29:18 2026 -0400
Use static imports only for JUnit
Rename internal test method
---
.../commons/compress/archivers/zip/ZipEncodingTest.java | 16 ++++++++--------
.../org/apache/commons/compress/osgi/Configurations.java | 4 ++--
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ZipEncodingTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ZipEncodingTest.java
index d565702c3..243e98c67 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/ZipEncodingTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/ZipEncodingTest.java
@@ -19,6 +19,7 @@
package org.apache.commons.compress.archivers.zip;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -28,7 +29,6 @@
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
@@ -43,11 +43,11 @@ class ZipEncodingTest {
private static final String BAD_STRING_ENC = "%U2016%U2015%U2016%U2015%U2016%U2015%U2016%U2015%U2016%U2015%U2016";
- private static void assertEquals(final byte[] expected, final ByteBuffer actual) {
- Assertions.assertEquals(expected.length, actual.limit());
+ private static void assertEquals1By1(final byte[] expected, final ByteBuffer actual) {
+ assertEquals(expected.length, actual.limit());
for (final byte anExpected : expected) {
final byte a = actual.get();
- Assertions.assertEquals(anExpected, a);
+ assertEquals(anExpected, a);
}
}
@@ -71,11 +71,11 @@ private void doSimpleEncodingTest(final String name, byte[] testBytes) throws IO
final String decoded = enc.decode(testBytes);
assertTrue(enc.canEncode(decoded));
final ByteBuffer encoded = enc.encode(decoded);
- assertEquals(testBytes, encoded);
+ assertEquals1By1(testBytes, encoded);
assertFalse(enc.canEncode(UNENC_STRING));
- assertEquals("%U2016".getBytes(name), enc.encode(UNENC_STRING));
+ assertEquals1By1("%U2016".getBytes(name), enc.encode(UNENC_STRING));
assertFalse(enc.canEncode(BAD_STRING));
- assertEquals(BAD_STRING_ENC.getBytes(name), enc.encode(BAD_STRING));
+ assertEquals1By1(BAD_STRING_ENC.getBytes(name), enc.encode(BAD_STRING));
}
@Test
@@ -89,7 +89,7 @@ void testGetNonexistentEncoding() {
assertNotNull(ze);
if (ze instanceof CharsetAccessor) {
final CharsetAccessor hasCharset = (CharsetAccessor) ze;
- Assertions.assertEquals(Charset.defaultCharset(), hasCharset.getCharset());
+ assertEquals(Charset.defaultCharset(), hasCharset.getCharset());
}
}
diff --git a/src/test/java/org/apache/commons/compress/osgi/Configurations.java b/src/test/java/org/apache/commons/compress/osgi/Configurations.java
index f6e0cef6e..bec6f273c 100644
--- a/src/test/java/org/apache/commons/compress/osgi/Configurations.java
+++ b/src/test/java/org/apache/commons/compress/osgi/Configurations.java
@@ -18,6 +18,7 @@
*/
package org.apache.commons.compress.osgi;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.ops4j.pax.exam.CoreOptions.bundle;
import static org.ops4j.pax.exam.CoreOptions.composite;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
@@ -25,7 +26,6 @@
import java.util.Arrays;
-import org.junit.jupiter.api.Assertions;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
@@ -53,7 +53,7 @@ public static Option[] getConfigWithoutOptionals() {
.filter(o -> !getCommonsIO().equals(o))
.toArray(Option[]::new);
// @formatter:on
- Assertions.assertTrue(result.length < defaultConfig.length, "Expected to have removed options.");
+ assertTrue(result.length < defaultConfig.length, "Expected to have removed options.");
return result;
}