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

Commit 229b9b3d authored by Diksha Gohlyan's avatar Diksha Gohlyan Committed by Automerger Merge Worker
Browse files

Correct ArchiveHandleTest to accomodate 0 size archive files am: 8dc0ccaf am: 55213aa5

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/DocumentsUI/+/12629402

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

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

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

        try {
            archiveHandle.getInputStream(archiveEntry);