Correct ArchiveHandleTest to accomodate 0 size archive files
Test: atest DocumentsUIGoogleTests
Fixes: 168782927
Change-Id: I88790ef5e4e95d5937072e41db1a0c35df74009d
diff --git a/tests/functional/com/android/documentsui/archives/ArchiveHandleTest.java b/tests/functional/com/android/documentsui/archives/ArchiveHandleTest.java
index ff43caf..50bc916 100644
--- a/tests/functional/com/android/documentsui/archives/ArchiveHandleTest.java
+++ b/tests/functional/com/android/documentsui/archives/ArchiveHandleTest.java
@@ -394,7 +394,7 @@
try {
archiveHandle.getInputStream(archiveEntry);
fail("It should not be here.");
- } catch (IllegalArgumentException | ArchiveException | CompressorException e) {
+ } catch (ClassCastException e) {
/* do nothing */
}
}
@@ -416,13 +416,13 @@
}
@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);