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 f95733778128985ce66dd5f76d848c4f06230425
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Tue Nov 28 08:00:19 2023 -0500

    Address compiler warnings in ArArchiveInputStreamTest
    
    Add test
---
 .../archivers/ar/ArArchiveInputStreamTest.java     | 30 ++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git 
a/src/test/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStreamTest.java
 
b/src/test/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStreamTest.java
index bd7638c83..cd81f44df 100644
--- 
a/src/test/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStreamTest.java
+++ 
b/src/test/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStreamTest.java
@@ -127,6 +127,36 @@ public class ArArchiveInputStreamTest extends AbstractTest 
{
 
     @Test
     public void testSimpleInputStream() throws IOException {
+        try (InputStream fileInputStream = newInputStream("bla.ar");
+
+                // This default implementation of InputStream.available() 
always returns zero,
+                // and there are many streams in practice where the total 
length of the stream is not known.
+
+                InputStream simpleInputStream = new InputStream() {
+                    @Override
+                    public int read() throws IOException {
+                        return fileInputStream.read();
+                    }
+                }) {
+
+            try (ArArchiveInputStream archiveInputStream = new 
ArArchiveInputStream(simpleInputStream)) {
+                final ArArchiveEntry entry1 = 
archiveInputStream.getNextEntry();
+                assertThat(entry1, not(nullValue()));
+                assertThat(entry1.getName(), equalTo("test1.xml"));
+                assertThat(entry1.getLength(), equalTo(610L));
+
+                final ArArchiveEntry entry2 = 
archiveInputStream.getNextEntry();
+                assertThat(entry2.getName(), equalTo("test2.xml"));
+                assertThat(entry2.getLength(), equalTo(82L));
+
+                assertThat(archiveInputStream.getNextEntry(), nullValue());
+            }
+        }
+    }
+
+    @SuppressWarnings("deprecation")
+    @Test
+    public void testSimpleInputStreamDeprecated() throws IOException {
         try (InputStream fileInputStream = newInputStream("bla.ar");
 
                 // This default implementation of InputStream.available() 
always returns zero,

Reply via email to