Code example for JarFile

Methods: getJarEntry

0
	 */ 
	public void testOpenConnectionWithWhenHandlerIsReused() throws Exception { 
		URL url = new URL("file:///sample2.jar!/test.class");
		handler.setExpectedUrl(url);
		JarEntry newJarEntry = mock(JarEntry.class);
		when(jarFile.getJarEntry("test/test.class")).thenReturn(newJarEntry);
		URLConnection connection = new URL("jar", null, 0, "file:sample.jar!/test/test.class", handler)
				.openConnection();
		assertSame(jarFile, ((JarFileUrlConnection) connection).getJarFile());
		assertSame(newJarEntry, ((JarFileUrlConnection) connection).getJarEntry());
	} 
}