MCPcopy Create free account
hub / github.com/src-d/hercules / testUnexplode

Method testUnexplode

internal/test_data/2.java:176–198  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

174 }
175
176 public void testUnexplode() throws IOException {
177 File file = File.createTempFile("tempFile", null);
178 File tmpDir = file.getParentFile();
179
180 unexplodeWithException(file, "shouldn't be able to unexplode file that is not a directory");
181 assertTrue("Should be able to delete tmp file", file.delete());
182 unexplodeWithException(file, "shouldn't be able to unexplode file that doesn't exist");
183
184 // create empty tmp dir with the same name as deleted file
185 File dir = new File(tmpDir, file.getName());
186 dir.deleteOnExit();
187 assertTrue("Should be able to create directory with the same name as there was tmp file", dir.mkdir());
188
189 unexplodeWithException(dir, "shouldn't be able to unexplode dir that doesn't contain any files");
190
191 // unexplode should succeed with at least one file in directory
192 File.createTempFile("temp", null, dir);
193 ZipUtil.unexplode(dir);
194
195 assertTrue("zip file should exist with the same name as the directory that was unexploded", dir.exists());
196 assertTrue("unexploding input directory should have produced zip file with the same name", !dir.isDirectory());
197 assertTrue("Should be able to delete zip that was created from directory", dir.delete());
198 }
199
200 public void testPackEntry() throws Exception {
201 File fileToPack = new File(getClass().getResource("TestFile.txt").getPath());

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected