()
| 32 | public class ZipUtilTest extends TestCase { |
| 33 | |
| 34 | public void testUnpackEntryFromFile() throws IOException { |
| 35 | final String name = "foo"; |
| 36 | final byte[] contents = "bar".getBytes(); |
| 37 | |
| 38 | File file = File.createTempFile("temp", null); |
| 39 | try { |
| 40 | // Create the ZIP file |
| 41 | ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(file)); |
| 42 | try { |
| 43 | zos.putNextEntry(new ZipEntry(name)); |
| 44 | zos.write(contents); |
| 45 | zos.closeEntry(); |
| 46 | } |
| 47 | finally { |
| 48 | IOUtils.closeQuietly(zos); |
| 49 | } |
| 50 | |
| 51 | // Test the ZipUtil |
| 52 | byte[] actual = ZipUtil.unpackEntry(file, name); |
| 53 | assertNotNull(actual); |
| 54 | assertEquals(new String(contents), new String(actual)); |
| 55 | } |
| 56 | // 1 |
| 57 | |
| 58 | // 2 |
| 59 | |
| 60 | // 3 |
| 61 | finally { |
| 62 | FileUtils.deleteQuietly(file); |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | public void testUnpackEntryFromStreamToFile() throws IOException { |
| 67 | final String name = "foo"; |
nothing calls this directly
no outgoing calls
no test coverage detected