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 2022/05/05 19:58:30 UTC

[commons-compress] branch master updated (33f57cf6 -> ea710145)

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 33f57cf6 Fix broken tests.
     new 47043448 Fix broken tests.
     new 973120be Whitespace.
     new ea710145 Fix broken tests.

The 3 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     | 15 ++++++------
 .../compress/utils/ServiceLoaderIteratorTest.java  | 27 +++++-----------------
 2 files changed, 14 insertions(+), 28 deletions(-)


[commons-compress] 03/03: Fix broken tests.

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 ea710145f34c0a4a286e22d93c11388584452b43
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu May 5 15:58:25 2022 -0400

    Fix broken tests.
---
 .../commons/compress/utils/ServiceLoaderIteratorTest.java     | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/test/java/org/apache/commons/compress/utils/ServiceLoaderIteratorTest.java b/src/test/java/org/apache/commons/compress/utils/ServiceLoaderIteratorTest.java
index 6aaac6e7..ee5ec114 100644
--- a/src/test/java/org/apache/commons/compress/utils/ServiceLoaderIteratorTest.java
+++ b/src/test/java/org/apache/commons/compress/utils/ServiceLoaderIteratorTest.java
@@ -18,11 +18,12 @@
  */
 package org.apache.commons.compress.utils;
 
-import org.junit.jupiter.api.Test;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertThrows;
 
 import java.util.NoSuchElementException;
 
-import static org.junit.Assert.assertFalse;
+import org.junit.jupiter.api.Test;
 
 /**
  * Unit tests for class {@link ServiceLoaderIterator org.apache.commons.compress.utils.ServiceLoaderIterator}.
@@ -36,7 +37,7 @@ public class ServiceLoaderIteratorTest {
     public void testNextThrowsNoSuchElementException() {
         final Class<String> clasz = String.class;
         final ServiceLoaderIterator<String> serviceLoaderIterator = new ServiceLoaderIterator<>(clasz);
-        serviceLoaderIterator.next();
+        assertThrows(NoSuchElementException.class, () -> serviceLoaderIterator.next());
     }
 
     @Test
@@ -51,7 +52,7 @@ public class ServiceLoaderIteratorTest {
     public void testRemoveThrowsUnsupportedOperationException() {
         final Class<Integer> clasz = Integer.class;
         final ServiceLoaderIterator<Integer> serviceLoaderIterator = new ServiceLoaderIterator<>(clasz);
-        serviceLoaderIterator.remove();
+        assertThrows(UnsupportedOperationException.class, () -> serviceLoaderIterator.remove());
     }
 
-}
\ No newline at end of file
+}


[commons-compress] 01/03: Fix broken tests.

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 47043448a42634b2f85b0ff0543a225b64fb0884
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu May 5 15:57:12 2022 -0400

    Fix broken tests.
---
 .../compress/utils/SeekableInMemoryByteChannelTest.java   | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 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 65abec12..6fd0381a 100644
--- a/src/test/java/org/apache/commons/compress/utils/SeekableInMemoryByteChannelTest.java
+++ b/src/test/java/org/apache/commons/compress/utils/SeekableInMemoryByteChannelTest.java
@@ -31,6 +31,7 @@ import static java.nio.charset.StandardCharsets.*;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertThrows;
 
 public class SeekableInMemoryByteChannelTest {
 
@@ -100,7 +101,7 @@ public class SeekableInMemoryByteChannelTest {
         final SeekableInMemoryByteChannel c = new SeekableInMemoryByteChannel();
         //when
         c.close();
-        c.read(ByteBuffer.allocate(1));
+        assertThrows(ClosedChannelException.class, () -> c.read(ByteBuffer.allocate(1)));
     }
 
     @Test
@@ -141,7 +142,7 @@ public class SeekableInMemoryByteChannelTest {
         final SeekableInMemoryByteChannel c = new SeekableInMemoryByteChannel();
         //when
         c.close();
-        c.write(ByteBuffer.allocate(1));
+        assertThrows(ClosedChannelException.class, () -> c.write(ByteBuffer.allocate(1)));
     }
 
     @Test
@@ -189,7 +190,7 @@ public class SeekableInMemoryByteChannelTest {
         //given
         final SeekableInMemoryByteChannel c = new SeekableInMemoryByteChannel();
         //when
-        c.position(Integer.MAX_VALUE + 1L);
+        assertThrows(IOException.class, () -> c.position(Integer.MAX_VALUE + 1L));
         c.close();
     }
 
@@ -198,7 +199,7 @@ public class SeekableInMemoryByteChannelTest {
         //given
         final SeekableInMemoryByteChannel c = new SeekableInMemoryByteChannel();
         //when
-        c.truncate(Integer.MAX_VALUE + 1L);
+        assertThrows(IllegalArgumentException.class, () -> c.truncate(Integer.MAX_VALUE + 1L));
         c.close();
     }
 
@@ -256,7 +257,7 @@ public class SeekableInMemoryByteChannelTest {
     public void throwsClosedChannelExceptionWhenPositionIsSetOnClosedChannel() throws Exception {
         try (SeekableByteChannel c = new SeekableInMemoryByteChannel()) {
             c.close();
-            c.position(0);
+            assertThrows(ClosedChannelException.class, () -> c.position(0));
         }
     }
 
@@ -302,7 +303,7 @@ public class SeekableInMemoryByteChannelTest {
     @Test
     public void throwsIOExceptionWhenPositionIsSetToANegativeValue() throws Exception {
         try (SeekableByteChannel c = new SeekableInMemoryByteChannel()) {
-            c.position(-1);
+            assertThrows(IOException.class, () -> c.position(-1));
         }
     }
 
@@ -396,7 +397,7 @@ public class SeekableInMemoryByteChannelTest {
     @Test
     public void throwsIllegalArgumentExceptionWhenTruncatingToANegativeSize() throws Exception {
         try (SeekableByteChannel c = new SeekableInMemoryByteChannel()) {
-            c.truncate(-1);
+            assertThrows(IllegalArgumentException.class, () -> c.truncate(-1));
         }
     }
 


[commons-compress] 02/03: Whitespace.

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 973120be646cfe708eeb48c119544eebfdbc68dc
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu May 5 15:57:21 2022 -0400

    Whitespace.
---
 .../compress/utils/ServiceLoaderIteratorTest.java        | 16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/src/test/java/org/apache/commons/compress/utils/ServiceLoaderIteratorTest.java b/src/test/java/org/apache/commons/compress/utils/ServiceLoaderIteratorTest.java
index 6916c6b8..6aaac6e7 100644
--- a/src/test/java/org/apache/commons/compress/utils/ServiceLoaderIteratorTest.java
+++ b/src/test/java/org/apache/commons/compress/utils/ServiceLoaderIteratorTest.java
@@ -32,42 +32,26 @@ import static org.junit.Assert.assertFalse;
  **/
 public class ServiceLoaderIteratorTest {
 
-
-
     @Test
     public void testNextThrowsNoSuchElementException() {
-
         final Class<String> clasz = String.class;
         final ServiceLoaderIterator<String> serviceLoaderIterator = new ServiceLoaderIterator<>(clasz);
-
         serviceLoaderIterator.next();
-
     }
 
-
     @Test
     public void testHasNextReturnsFalse() {
-
         final Class<Object> clasz = Object.class;
         final ServiceLoaderIterator<Object> serviceLoaderIterator = new ServiceLoaderIterator<>(clasz);
         final boolean result = serviceLoaderIterator.hasNext();
-
         assertFalse(result);
-
     }
 
-
     @Test
     public void testRemoveThrowsUnsupportedOperationException() {
-
         final Class<Integer> clasz = Integer.class;
         final ServiceLoaderIterator<Integer> serviceLoaderIterator = new ServiceLoaderIterator<>(clasz);
-
         serviceLoaderIterator.remove();
-
-
     }
 
-
-
 }
\ No newline at end of file