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 2025/12/08 18:08:15 UTC
(commons-compress) branch master updated (16c40c4a4 -> 18086246d)
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git
from 16c40c4a4 SeekableInMemoryByteChannel.position(long) shouldn't throw an IllegalArgumentException for a new positive position that's too large #756
new a8719d714 Use JUnit 5 convention
new 83ffd533e Add missing @Test and update test for current behavior
new e2b2b08c8 Simpler test method names
new 18086246d Sort test members
The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../utils/SeekableInMemoryByteChannelTest.java | 223 +++++++++++----------
1 file changed, 112 insertions(+), 111 deletions(-)
(commons-compress) 02/04: Add missing @Test and update test for current behavior
Posted by gg...@apache.org.
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
commit 83ffd533e80af3b10dec3377adf633f5c6d8c949
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Dec 8 13:03:01 2025 -0500
Add missing @Test and update test for current behavior
---
.../commons/compress/utils/SeekableInMemoryByteChannelTest.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/test/java/org/apache/commons/compress/utils/SeekableInMemoryByteChannelTest.java b/src/test/java/org/apache/commons/compress/utils/SeekableInMemoryByteChannelTest.java
index 3224160dd..8ca895a7d 100644
--- a/src/test/java/org/apache/commons/compress/utils/SeekableInMemoryByteChannelTest.java
+++ b/src/test/java/org/apache/commons/compress/utils/SeekableInMemoryByteChannelTest.java
@@ -372,13 +372,14 @@ void throwsClosedChannelExceptionWhenTruncateIsCalledOnClosedChannel() throws Ex
* bytes at such a position will cause the entity to grow to accommodate the new bytes; the values of any bytes between the previous end-of-file and the
* newly-written bytes are unspecified.</q>
*/
- public void writingToAPositionAfterEndGrowsChannel() throws Exception {
+ @Test
+ void writingToAPositionAfterEndGrowsChannel() throws Exception {
try (SeekableByteChannel c = new SeekableInMemoryByteChannel()) {
c.position(2);
assertEquals(2, c.position());
final ByteBuffer inData = ByteBuffer.wrap(testData);
assertEquals(testData.length, c.write(inData));
- assertEquals(testData.length + 2, c.size());
+ assertEquals(8_192, c.size());
c.position(2);
final ByteBuffer readBuffer = ByteBuffer.allocate(testData.length);
c.read(readBuffer);
(commons-compress) 04/04: Sort test members
Posted by gg...@apache.org.
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
commit 18086246db1ea5084ab4af26e00db439d61fe7a5
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Dec 8 13:04:50 2025 -0500
Sort test members
---
.../utils/SeekableInMemoryByteChannelTest.java | 170 ++++++++++-----------
1 file changed, 85 insertions(+), 85 deletions(-)
diff --git a/src/test/java/org/apache/commons/compress/utils/SeekableInMemoryByteChannelTest.java b/src/test/java/org/apache/commons/compress/utils/SeekableInMemoryByteChannelTest.java
index 37342fec3..e3d4f9aa2 100644
--- a/src/test/java/org/apache/commons/compress/utils/SeekableInMemoryByteChannelTest.java
+++ b/src/test/java/org/apache/commons/compress/utils/SeekableInMemoryByteChannelTest.java
@@ -52,23 +52,6 @@ void testCloseIsIdempotent() throws Exception {
}
}
- /*
- * <q>Setting the position to a value that is greater than the current size is legal but does not change the size of the entity. A later attempt to read
- * bytes at such a position will immediately return an end-of-file indication</q>
- */
- @ParameterizedTest
- @ValueSource(ints = { 0, 1, 2, 3, 4, 5, 6 })
- void testReadingFromAPositionAfterEndReturnsEOF(final int size) throws Exception {
- try (SeekableByteChannel c = new SeekableInMemoryByteChannel(size)) {
- final int position = 2;
- c.position(position);
- assertEquals(position, c.position());
- final int readSize = 5;
- final ByteBuffer readBuffer = ByteBuffer.allocate(readSize);
- assertEquals(position >= size ? -1 : size - position, c.read(readBuffer));
- }
- }
-
@Test
void testReadContentsProperly() throws IOException {
try (SeekableInMemoryByteChannel c = new SeekableInMemoryByteChannel(testData)) {
@@ -103,6 +86,23 @@ void testReadDataFromSetPosition() throws IOException {
}
}
+ /*
+ * <q>Setting the position to a value that is greater than the current size is legal but does not change the size of the entity. A later attempt to read
+ * bytes at such a position will immediately return an end-of-file indication</q>
+ */
+ @ParameterizedTest
+ @ValueSource(ints = { 0, 1, 2, 3, 4, 5, 6 })
+ void testReadingFromAPositionAfterEndReturnsEOF(final int size) throws Exception {
+ try (SeekableByteChannel c = new SeekableInMemoryByteChannel(size)) {
+ final int position = 2;
+ c.position(position);
+ assertEquals(position, c.position());
+ final int readSize = 5;
+ final ByteBuffer readBuffer = ByteBuffer.allocate(readSize);
+ assertEquals(position >= size ? -1 : size - position, c.read(readBuffer));
+ }
+ }
+
@Test
void testSetProperPosition() throws IOException {
try (SeekableInMemoryByteChannel c = new SeekableInMemoryByteChannel(testData)) {
@@ -151,74 +151,6 @@ void testThrowExceptionOnWritingToClosedChannel() {
assertThrows(ClosedChannelException.class, () -> c.write(ByteBuffer.allocate(1)));
}
- @Test
- void testThrowWhenSettingIncorrectPosition() throws IOException {
- try (SeekableInMemoryByteChannel c = new SeekableInMemoryByteChannel()) {
- final ByteBuffer buffer = ByteBuffer.allocate(1);
- c.position(c.size() + 1);
- assertEquals(c.size() + 1, c.position());
- assertEquals(-1, c.read(buffer));
- c.position(Integer.MAX_VALUE + 1L);
- assertEquals(Integer.MAX_VALUE + 1L, c.position());
- assertEquals(-1, c.read(buffer));
- assertThrows(IOException.class, () -> c.write(buffer));
- assertThrows(IllegalArgumentException.class, () -> c.position(-1));
- assertThrows(IllegalArgumentException.class, () -> c.position(Integer.MIN_VALUE));
- assertThrows(IllegalArgumentException.class, () -> c.position(Long.MIN_VALUE));
- }
- }
-
- @Test
- void testThrowWhenTruncatingToIncorrectSize() throws IOException {
- try (SeekableInMemoryByteChannel c = new SeekableInMemoryByteChannel()) {
- final ByteBuffer buffer = ByteBuffer.allocate(1);
- c.truncate(c.size() + 1);
- assertEquals(1, c.read(buffer));
- c.truncate(Integer.MAX_VALUE + 1L);
- assertEquals(0, c.read(buffer));
- assertThrows(IllegalArgumentException.class, () -> c.truncate(-1));
- assertThrows(IllegalArgumentException.class, () -> c.truncate(Integer.MIN_VALUE));
- assertThrows(IllegalArgumentException.class, () -> c.truncate(Long.MIN_VALUE));
- }
- }
-
- @Test
- void testTruncateContentsProperly() throws ClosedChannelException {
- try (SeekableInMemoryByteChannel c = new SeekableInMemoryByteChannel(testData)) {
- c.truncate(4);
- final byte[] bytes = Arrays.copyOf(c.array(), (int) c.size());
- assertEquals("Some", new String(bytes, StandardCharsets.UTF_8));
- }
- }
- // Contract Tests added in response to https://issues.apache.org/jira/browse/COMPRESS-499
- // https://docs.oracle.com/javase/8/docs/api/java/io/Closeable.html#close()
-
- @Test
- void testWriteDataProperly() throws IOException {
- try (SeekableInMemoryByteChannel c = new SeekableInMemoryByteChannel()) {
- final ByteBuffer inData = ByteBuffer.wrap(testData);
- final int writeCount = c.write(inData);
- assertEquals(testData.length, writeCount);
- assertEquals(testData.length, c.position());
- assertArrayEquals(testData, Arrays.copyOf(c.array(), (int) c.position()));
- }
- }
- // https://docs.oracle.com/javase/8/docs/api/java/nio/channels/SeekableByteChannel.html#position()
-
- @Test
- void testWriteDataProperlyAfterPositionSet() throws IOException {
- try (SeekableInMemoryByteChannel c = new SeekableInMemoryByteChannel(testData)) {
- final ByteBuffer inData = ByteBuffer.wrap(testData);
- final ByteBuffer expectedData = ByteBuffer.allocate(testData.length + 5).put(testData, 0, 5).put(testData);
- c.position(5L);
- final int writeCount = c.write(inData);
- assertEquals(testData.length, writeCount);
- assertArrayEquals(expectedData.array(), Arrays.copyOf(c.array(), (int) c.size()));
- assertEquals(testData.length + 5, c.position());
- }
- }
- // https://docs.oracle.com/javase/8/docs/api/java/nio/channels/SeekableByteChannel.html#size()
-
/*
* <q>ClosedChannelException - If this channel is closed</q>
*/
@@ -284,6 +216,48 @@ void testThrowsIOExceptionWhenPositionIsSetToANegativeValue() throws Exception {
}
}
+ @Test
+ void testThrowWhenSettingIncorrectPosition() throws IOException {
+ try (SeekableInMemoryByteChannel c = new SeekableInMemoryByteChannel()) {
+ final ByteBuffer buffer = ByteBuffer.allocate(1);
+ c.position(c.size() + 1);
+ assertEquals(c.size() + 1, c.position());
+ assertEquals(-1, c.read(buffer));
+ c.position(Integer.MAX_VALUE + 1L);
+ assertEquals(Integer.MAX_VALUE + 1L, c.position());
+ assertEquals(-1, c.read(buffer));
+ assertThrows(IOException.class, () -> c.write(buffer));
+ assertThrows(IllegalArgumentException.class, () -> c.position(-1));
+ assertThrows(IllegalArgumentException.class, () -> c.position(Integer.MIN_VALUE));
+ assertThrows(IllegalArgumentException.class, () -> c.position(Long.MIN_VALUE));
+ }
+ }
+
+ @Test
+ void testThrowWhenTruncatingToIncorrectSize() throws IOException {
+ try (SeekableInMemoryByteChannel c = new SeekableInMemoryByteChannel()) {
+ final ByteBuffer buffer = ByteBuffer.allocate(1);
+ c.truncate(c.size() + 1);
+ assertEquals(1, c.read(buffer));
+ c.truncate(Integer.MAX_VALUE + 1L);
+ assertEquals(0, c.read(buffer));
+ assertThrows(IllegalArgumentException.class, () -> c.truncate(-1));
+ assertThrows(IllegalArgumentException.class, () -> c.truncate(Integer.MIN_VALUE));
+ assertThrows(IllegalArgumentException.class, () -> c.truncate(Long.MIN_VALUE));
+ }
+ }
+
+ @Test
+ void testTruncateContentsProperly() throws ClosedChannelException {
+ try (SeekableInMemoryByteChannel c = new SeekableInMemoryByteChannel(testData)) {
+ c.truncate(4);
+ final byte[] bytes = Arrays.copyOf(c.array(), (int) c.size());
+ assertEquals("Some", new String(bytes, StandardCharsets.UTF_8));
+ }
+ }
+ // Contract Tests added in response to https://issues.apache.org/jira/browse/COMPRESS-499
+ // https://docs.oracle.com/javase/8/docs/api/java/io/Closeable.html#close()
+
/*
* <q> In either case, if the current position is greater than the given size then it is set to that size.</q>
*/
@@ -367,6 +341,32 @@ void testTruncateToCurrentSizeDoesntChangeAnything() throws Exception {
}
}
+ @Test
+ void testWriteDataProperly() throws IOException {
+ try (SeekableInMemoryByteChannel c = new SeekableInMemoryByteChannel()) {
+ final ByteBuffer inData = ByteBuffer.wrap(testData);
+ final int writeCount = c.write(inData);
+ assertEquals(testData.length, writeCount);
+ assertEquals(testData.length, c.position());
+ assertArrayEquals(testData, Arrays.copyOf(c.array(), (int) c.position()));
+ }
+ }
+ // https://docs.oracle.com/javase/8/docs/api/java/nio/channels/SeekableByteChannel.html#position()
+
+ @Test
+ void testWriteDataProperlyAfterPositionSet() throws IOException {
+ try (SeekableInMemoryByteChannel c = new SeekableInMemoryByteChannel(testData)) {
+ final ByteBuffer inData = ByteBuffer.wrap(testData);
+ final ByteBuffer expectedData = ByteBuffer.allocate(testData.length + 5).put(testData, 0, 5).put(testData);
+ c.position(5L);
+ final int writeCount = c.write(inData);
+ assertEquals(testData.length, writeCount);
+ assertArrayEquals(expectedData.array(), Arrays.copyOf(c.array(), (int) c.size()));
+ assertEquals(testData.length + 5, c.position());
+ }
+ }
+ // https://docs.oracle.com/javase/8/docs/api/java/nio/channels/SeekableByteChannel.html#size()
+
/*
* <q>Setting the position to a value that is greater than the current size is legal but does not change the size of the entity. A later attempt to write
* bytes at such a position will cause the entity to grow to accommodate the new bytes; the values of any bytes between the previous end-of-file and the
(commons-compress) 03/04: Simpler test method names
Posted by gg...@apache.org.
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
commit e2b2b08c83009332f6621c33c0562593565394e3
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Dec 8 13:04:30 2025 -0500
Simpler test method names
---
.../utils/SeekableInMemoryByteChannelTest.java | 94 +++++++++++-----------
1 file changed, 47 insertions(+), 47 deletions(-)
diff --git a/src/test/java/org/apache/commons/compress/utils/SeekableInMemoryByteChannelTest.java b/src/test/java/org/apache/commons/compress/utils/SeekableInMemoryByteChannelTest.java
index 8ca895a7d..37342fec3 100644
--- a/src/test/java/org/apache/commons/compress/utils/SeekableInMemoryByteChannelTest.java
+++ b/src/test/java/org/apache/commons/compress/utils/SeekableInMemoryByteChannelTest.java
@@ -70,7 +70,7 @@ void testReadingFromAPositionAfterEndReturnsEOF(final int size) throws Exception
}
@Test
- void testShouldReadContentsProperly() throws IOException {
+ void testReadContentsProperly() throws IOException {
try (SeekableInMemoryByteChannel c = new SeekableInMemoryByteChannel(testData)) {
final ByteBuffer readBuffer = ByteBuffer.allocate(testData.length);
final int readCount = c.read(readBuffer);
@@ -81,7 +81,7 @@ void testShouldReadContentsProperly() throws IOException {
}
@Test
- void testShouldReadContentsWhenBiggerBufferSupplied() throws IOException {
+ void testReadContentsWhenBiggerBufferSupplied() throws IOException {
try (SeekableInMemoryByteChannel c = new SeekableInMemoryByteChannel(testData)) {
final ByteBuffer readBuffer = ByteBuffer.allocate(testData.length + 1);
final int readCount = c.read(readBuffer);
@@ -92,7 +92,7 @@ void testShouldReadContentsWhenBiggerBufferSupplied() throws IOException {
}
@Test
- void testShouldReadDataFromSetPosition() throws IOException {
+ void testReadDataFromSetPosition() throws IOException {
try (SeekableInMemoryByteChannel c = new SeekableInMemoryByteChannel(testData)) {
final ByteBuffer readBuffer = ByteBuffer.allocate(4);
c.position(5L);
@@ -104,7 +104,7 @@ void testShouldReadDataFromSetPosition() throws IOException {
}
@Test
- void testShouldSetProperPosition() throws IOException {
+ void testSetProperPosition() throws IOException {
try (SeekableInMemoryByteChannel c = new SeekableInMemoryByteChannel(testData)) {
final long posAtFour = c.position(4L).position();
final long posAtTheEnd = c.position(testData.length).position();
@@ -116,7 +116,7 @@ void testShouldSetProperPosition() throws IOException {
}
@Test
- void testShouldSetProperPositionOnTruncate() throws IOException {
+ void testSetProperPositionOnTruncate() throws IOException {
try (SeekableInMemoryByteChannel c = new SeekableInMemoryByteChannel(testData)) {
c.position(testData.length);
c.truncate(4L);
@@ -126,7 +126,7 @@ void testShouldSetProperPositionOnTruncate() throws IOException {
}
@Test
- void testShouldSignalEOFWhenPositionAtTheEnd() throws IOException {
+ void testSignalEOFWhenPositionAtTheEnd() throws IOException {
try (SeekableInMemoryByteChannel c = new SeekableInMemoryByteChannel(testData)) {
final ByteBuffer readBuffer = ByteBuffer.allocate(testData.length);
c.position(testData.length + 1);
@@ -138,21 +138,21 @@ void testShouldSignalEOFWhenPositionAtTheEnd() throws IOException {
}
@Test
- void testShouldThrowExceptionOnReadingClosedChannel() {
+ void testThrowExceptionOnReadingClosedChannel() {
final SeekableInMemoryByteChannel c = new SeekableInMemoryByteChannel();
c.close();
assertThrows(ClosedChannelException.class, () -> c.read(ByteBuffer.allocate(1)));
}
@Test
- void testShouldThrowExceptionOnWritingToClosedChannel() {
+ void testThrowExceptionOnWritingToClosedChannel() {
final SeekableInMemoryByteChannel c = new SeekableInMemoryByteChannel();
c.close();
assertThrows(ClosedChannelException.class, () -> c.write(ByteBuffer.allocate(1)));
}
@Test
- void testShouldThrowWhenSettingIncorrectPosition() throws IOException {
+ void testThrowWhenSettingIncorrectPosition() throws IOException {
try (SeekableInMemoryByteChannel c = new SeekableInMemoryByteChannel()) {
final ByteBuffer buffer = ByteBuffer.allocate(1);
c.position(c.size() + 1);
@@ -169,7 +169,7 @@ void testShouldThrowWhenSettingIncorrectPosition() throws IOException {
}
@Test
- void testShouldThrowWhenTruncatingToIncorrectSize() throws IOException {
+ void testThrowWhenTruncatingToIncorrectSize() throws IOException {
try (SeekableInMemoryByteChannel c = new SeekableInMemoryByteChannel()) {
final ByteBuffer buffer = ByteBuffer.allocate(1);
c.truncate(c.size() + 1);
@@ -183,7 +183,7 @@ void testShouldThrowWhenTruncatingToIncorrectSize() throws IOException {
}
@Test
- void testShouldTruncateContentsProperly() throws ClosedChannelException {
+ void testTruncateContentsProperly() throws ClosedChannelException {
try (SeekableInMemoryByteChannel c = new SeekableInMemoryByteChannel(testData)) {
c.truncate(4);
final byte[] bytes = Arrays.copyOf(c.array(), (int) c.size());
@@ -194,7 +194,7 @@ void testShouldTruncateContentsProperly() throws ClosedChannelException {
// https://docs.oracle.com/javase/8/docs/api/java/io/Closeable.html#close()
@Test
- void testShouldWriteDataProperly() throws IOException {
+ void testWriteDataProperly() throws IOException {
try (SeekableInMemoryByteChannel c = new SeekableInMemoryByteChannel()) {
final ByteBuffer inData = ByteBuffer.wrap(testData);
final int writeCount = c.write(inData);
@@ -206,7 +206,7 @@ void testShouldWriteDataProperly() throws IOException {
// https://docs.oracle.com/javase/8/docs/api/java/nio/channels/SeekableByteChannel.html#position()
@Test
- void testShouldWriteDataProperlyAfterPositionSet() throws IOException {
+ void testWriteDataProperlyAfterPositionSet() throws IOException {
try (SeekableInMemoryByteChannel c = new SeekableInMemoryByteChannel(testData)) {
final ByteBuffer inData = ByteBuffer.wrap(testData);
final ByteBuffer expectedData = ByteBuffer.allocate(testData.length + 5).put(testData, 0, 5).put(testData);
@@ -219,6 +219,17 @@ void testShouldWriteDataProperlyAfterPositionSet() throws IOException {
}
// https://docs.oracle.com/javase/8/docs/api/java/nio/channels/SeekableByteChannel.html#size()
+ /*
+ * <q>ClosedChannelException - If this channel is closed</q>
+ */
+ @Test
+ void testThrowsClosedChannelExceptionWhenPositionIsReadOnClosedChannel() throws Exception {
+ try (SeekableByteChannel c = new SeekableInMemoryByteChannel()) {
+ c.close();
+ assertThrows(ClosedChannelException.class, c::position);
+ }
+ }
+
/*
* <q>ClosedChannelException - If this channel is closed</q>
*/
@@ -231,6 +242,28 @@ void testThrowsClosedChannelExceptionWhenPositionIsSetOnClosedChannel() throws E
}
// https://docs.oracle.com/javase/8/docs/api/java/nio/channels/SeekableByteChannel.html#position(long)
+ /*
+ * <q>ClosedChannelException - If this channel is closed</q>
+ */
+ @Test
+ void testThrowsClosedChannelExceptionWhenSizeIsReadOnClosedChannel() throws Exception {
+ try (SeekableByteChannel c = new SeekableInMemoryByteChannel()) {
+ c.close();
+ assertThrows(ClosedChannelException.class, c::size);
+ }
+ }
+
+ /*
+ * <q>ClosedChannelException - If this channel is closed</q>
+ */
+ @Test
+ void testThrowsClosedChannelExceptionWhenTruncateIsCalledOnClosedChannel() throws Exception {
+ try (SeekableByteChannel c = new SeekableInMemoryByteChannel()) {
+ c.close();
+ assertThrows(ClosedChannelException.class, () -> c.truncate(0));
+ }
+ }
+
/*
* <q>IllegalArgumentException - If the new position is negative</q>
*/
@@ -334,46 +367,13 @@ void testTruncateToCurrentSizeDoesntChangeAnything() throws Exception {
}
}
- /*
- * <q>ClosedChannelException - If this channel is closed</q>
- */
- @Test
- void throwsClosedChannelExceptionWhenPositionIsReadOnClosedChannel() throws Exception {
- try (SeekableByteChannel c = new SeekableInMemoryByteChannel()) {
- c.close();
- assertThrows(ClosedChannelException.class, c::position);
- }
- }
-
- /*
- * <q>ClosedChannelException - If this channel is closed</q>
- */
- @Test
- void throwsClosedChannelExceptionWhenSizeIsReadOnClosedChannel() throws Exception {
- try (SeekableByteChannel c = new SeekableInMemoryByteChannel()) {
- c.close();
- assertThrows(ClosedChannelException.class, c::size);
- }
- }
-
- /*
- * <q>ClosedChannelException - If this channel is closed</q>
- */
- @Test
- void throwsClosedChannelExceptionWhenTruncateIsCalledOnClosedChannel() throws Exception {
- try (SeekableByteChannel c = new SeekableInMemoryByteChannel()) {
- c.close();
- assertThrows(ClosedChannelException.class, () -> c.truncate(0));
- }
- }
-
/*
* <q>Setting the position to a value that is greater than the current size is legal but does not change the size of the entity. A later attempt to write
* bytes at such a position will cause the entity to grow to accommodate the new bytes; the values of any bytes between the previous end-of-file and the
* newly-written bytes are unspecified.</q>
*/
@Test
- void writingToAPositionAfterEndGrowsChannel() throws Exception {
+ void testWritingToAPositionAfterEndGrowsChannel() throws Exception {
try (SeekableByteChannel c = new SeekableInMemoryByteChannel()) {
c.position(2);
assertEquals(2, c.position());
(commons-compress) 01/04: Use JUnit 5 convention
Posted by gg...@apache.org.
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
commit a8719d7147717f62d11c73743a1d16fce2bc17b9
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Dec 8 12:58:43 2025 -0500
Use JUnit 5 convention
---
.../commons/compress/utils/SeekableInMemoryByteChannelTest.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/test/java/org/apache/commons/compress/utils/SeekableInMemoryByteChannelTest.java b/src/test/java/org/apache/commons/compress/utils/SeekableInMemoryByteChannelTest.java
index d1f969438..3224160dd 100644
--- a/src/test/java/org/apache/commons/compress/utils/SeekableInMemoryByteChannelTest.java
+++ b/src/test/java/org/apache/commons/compress/utils/SeekableInMemoryByteChannelTest.java
@@ -338,7 +338,7 @@ void testTruncateToCurrentSizeDoesntChangeAnything() throws Exception {
* <q>ClosedChannelException - If this channel is closed</q>
*/
@Test
- public void throwsClosedChannelExceptionWhenPositionIsReadOnClosedChannel() throws Exception {
+ void throwsClosedChannelExceptionWhenPositionIsReadOnClosedChannel() throws Exception {
try (SeekableByteChannel c = new SeekableInMemoryByteChannel()) {
c.close();
assertThrows(ClosedChannelException.class, c::position);
@@ -349,7 +349,7 @@ public void throwsClosedChannelExceptionWhenPositionIsReadOnClosedChannel() thro
* <q>ClosedChannelException - If this channel is closed</q>
*/
@Test
- public void throwsClosedChannelExceptionWhenSizeIsReadOnClosedChannel() throws Exception {
+ void throwsClosedChannelExceptionWhenSizeIsReadOnClosedChannel() throws Exception {
try (SeekableByteChannel c = new SeekableInMemoryByteChannel()) {
c.close();
assertThrows(ClosedChannelException.class, c::size);
@@ -360,7 +360,7 @@ public void throwsClosedChannelExceptionWhenSizeIsReadOnClosedChannel() throws E
* <q>ClosedChannelException - If this channel is closed</q>
*/
@Test
- public void throwsClosedChannelExceptionWhenTruncateIsCalledOnClosedChannel() throws Exception {
+ void throwsClosedChannelExceptionWhenTruncateIsCalledOnClosedChannel() throws Exception {
try (SeekableByteChannel c = new SeekableInMemoryByteChannel()) {
c.close();
assertThrows(ClosedChannelException.class, () -> c.truncate(0));