ZipEntryRequestFactory extends AbstractArchiveRequestFactory<InputStream> { @Override public final ZipEntryIdentificationRequest newRequest(RequestMetaData metaData, RequestIdentifier identifier) { return new ZipEntryIdentificationRequest(metaData, identifier, getTempDirLocation()); }  @Override final ZipEntryIdentificationRequest newRequest(RequestMetaData metaData,
                                                          RequestIdentifier identifier);  }
@Test public void testNewZipRequest() throws Exception { URI zipUri = new URI("zip:file:/foo.bar!/fu.bah"); RequestMetaData metaData = new RequestMetaData(12345L, 67890L, "fu.bah"); InputStream in = mock(InputStream.class); when(in.read()).thenReturn(-1); when(in.read(any(byte[].class))).thenReturn(-1); when(in.read(any(byte[].class), anyInt(), anyInt())).thenReturn(-1); when(in.skip(anyLong())).thenReturn(-1L); RequestIdentifier identifier = new RequestIdentifier(zipUri); IdentificationRequest request = factory.newRequest(metaData, identifier); request.open(in); assertTrue(request instanceof ZipEntryIdentificationRequest); assertEquals("fu.bah", request.getFileName()); assertEquals("bah", request.getExtension()); assertEquals(metaData, request.getRequestMetaData()); assertEquals(identifier, request.getIdentifier()); }