### Question:
JarResources { public byte[] getResource(String name) { if (classContents.containsKey(name)) { return classContents.get(name); } try { InputStream input = getResourceAsStream(name); if (input == null) { return null; } try { return ByteStreams.toByteArray(input); } finally { input.close(); } } catch (IOException e) { return null; } } JarResources(Location jar); Manifest getManifest(); boolean contains(String name); byte[] getResource(String name); InputStream getResourceAsStream(String name);  }### Answer:
@Test public void testGetResource() throws IOException { File jarFile = createJar(tmpFolder.newFile()); Location jarLocation = new LocalLocationFactory(jarFile.getParentFile()).create(jarFile.toURI()); String classPath = JarResourcesTest.class.getName().replace('.', '/') + ".class"; JarResources jarResources = new JarResources(jarLocation); Assert.assertFalse(jarResources.contains("test")); Assert.assertTrue(jarResources.contains("logback-test.xml")); Assert.assertTrue(jarResources.contains(classPath)); Assert.assertArrayEquals( ByteStreams.toByteArray(getClass().getClassLoader().getResourceAsStream("logback-test.xml")), jarResources.getResource("logback-test.xml") ); Assert.assertArrayEquals( ByteStreams.toByteArray(getClass().getClassLoader().getResourceAsStream(classPath)), jarResources.getResource(classPath) ); Assert.assertArrayEquals( ByteStreams.toByteArray(getClass().getClassLoader().getResourceAsStream("logback-test.xml")), ByteStreams.toByteArray(jarResources.getResourceAsStream("logback-test.xml")) ); Assert.assertArrayEquals( ByteStreams.toByteArray(getClass().getClassLoader().getResourceAsStream(classPath)), ByteStreams.toByteArray(jarResources.getResourceAsStream(classPath)) ); }