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 32add381d9da3d5c738a1694887f48429e480f7b Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Sun Dec 11 01:51:18 2022 -0500 Replace hack with standard code Fixes serialVersionUID warnings --- .../commons/compress/archivers/ZipTestCase.java | 35 +++++++++------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/src/test/java/org/apache/commons/compress/archivers/ZipTestCase.java b/src/test/java/org/apache/commons/compress/archivers/ZipTestCase.java index b053d04f..209d3884 100644 --- a/src/test/java/org/apache/commons/compress/archivers/ZipTestCase.java +++ b/src/test/java/org/apache/commons/compress/archivers/ZipTestCase.java @@ -269,53 +269,46 @@ public final class ZipTestCase extends AbstractTestCase { @Test public void inputStreamStatisticsForBzip2Entry() throws IOException, ArchiveException { - final Map<String, List<Long>> expected = new HashMap<String, List<Long>>() {{ - put("lots-of-as", Arrays.asList(42L, 39L)); - }}; + final Map<String, List<Long>> expected = new HashMap<>(); + expected.put("lots-of-as", Arrays.asList(42L, 39L)); testInputStreamStatistics("bzip2-zip.zip", expected); } @Test public void inputStreamStatisticsForDeflate64Entry() throws IOException, ArchiveException { - final Map<String, List<Long>> expected = new HashMap<String, List<Long>>() {{ - put("input2", Arrays.asList(3072L, 2111L)); - }}; + final Map<String, List<Long>> expected = new HashMap<>(); + expected.put("input2", Arrays.asList(3072L, 2111L)); testInputStreamStatistics("COMPRESS-380/COMPRESS-380.zip", expected); } @Test public void inputStreamStatisticsForImplodedEntry() throws IOException, ArchiveException { - final Map<String, List<Long>> expected = new HashMap<String, List<Long>>() {{ - put("LICENSE.TXT", Arrays.asList(11560L, 4131L)); - }}; + final Map<String, List<Long>> expected = new HashMap<>(); + expected.put("LICENSE.TXT", Arrays.asList(11560L, 4131L)); testInputStreamStatistics("imploding-8Kdict-3trees.zip", expected); } - @Test public void inputStreamStatisticsForShrunkEntry() throws IOException, ArchiveException { - final Map<String, List<Long>> expected = new HashMap<String, List<Long>>() {{ - put("TEST1.XML", Arrays.asList(76L, 66L)); - put("TEST2.XML", Arrays.asList(81L, 76L)); - }}; + final Map<String, List<Long>> expected = new HashMap<>(); + expected.put("TEST1.XML", Arrays.asList(76L, 66L)); + expected.put("TEST2.XML", Arrays.asList(81L, 76L)); testInputStreamStatistics("SHRUNK.ZIP", expected); } @Test public void inputStreamStatisticsForStoredEntry() throws IOException, ArchiveException { - final Map<String, List<Long>> expected = new HashMap<String, List<Long>>() {{ - put("test.txt", Arrays.asList(5L, 5L)); - }}; + final Map<String, List<Long>> expected = new HashMap<>(); + expected.put("test.txt", Arrays.asList(5L, 5L)); testInputStreamStatistics("COMPRESS-264.zip", expected); } @Test public void inputStreamStatisticsOfZipBombExcel() throws IOException, ArchiveException { - final Map<String, List<Long>> expected = new HashMap<String, List<Long>>() {{ - put("[Content_Types].xml", Arrays.asList(8390036L, 8600L)); - put("xl/worksheets/sheet1.xml", Arrays.asList(1348L, 508L)); - }}; + final Map<String, List<Long>> expected = new HashMap<>(); + expected.put("[Content_Types].xml", Arrays.asList(8390036L, 8600L)); + expected.put("xl/worksheets/sheet1.xml", Arrays.asList(1348L, 508L)); testInputStreamStatistics("zipbomb.xlsx", expected); }