Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8dc0ccaf authored by Diksha Gohlyan's avatar Diksha Gohlyan
Browse files

Correct ArchiveHandleTest to accomodate 0 size archive files

Test: atest DocumentsUIGoogleTests
Fixes: 168782927

Change-Id: I88790ef5e4e95d5937072e41db1a0c35df74009d
parent cce7f88c
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -394,7 +394,7 @@ public class ArchiveHandleTest {
        try {
        try {
            archiveHandle.getInputStream(archiveEntry);
            archiveHandle.getInputStream(archiveEntry);
            fail("It should not be here.");
            fail("It should not be here.");
        } catch (IllegalArgumentException | ArchiveException | CompressorException e) {
        } catch (ClassCastException e) {
            /* do nothing */
            /* do nothing */
        }
        }
    }
    }
@@ -416,13 +416,13 @@ public class ArchiveHandleTest {
    }
    }


    @Test
    @Test
    public void getInputStream_zeroSizeEntry_shouldFail() throws Exception {
    public void getInputStream_negativeSizeEntry_shouldFail() throws Exception {
        ArchiveHandle archiveHandle = prepareArchiveHandle("archives/zip/hello.zip",
        ArchiveHandle archiveHandle = prepareArchiveHandle("archives/zip/hello.zip",
                ".zip", "application/zip");
                ".zip", "application/zip");


        ArchiveEntry archiveEntry = mock(ArchiveEntry.class);
        ArchiveEntry archiveEntry = mock(ArchiveEntry.class);
        when(archiveEntry.isDirectory()).thenReturn(false);
        when(archiveEntry.isDirectory()).thenReturn(false);
        when(archiveEntry.getSize()).thenReturn(0L);
        when(archiveEntry.getSize()).thenReturn(-1L);


        try {
        try {
            archiveHandle.getInputStream(archiveEntry);
            archiveHandle.getInputStream(archiveEntry);