### Question:
HadoopDelete { static int exec(String... args) { if (args.length == 0) { LOG.warn("there are no files to delete"); return -1; } boolean sawError = false; Configuration conf = new Configuration(); for (String arg : args) { try { delete(conf, new Path(arg)); } catch (IOException e) { LOG.error(MessageFormat.format( "failed to delete file: {0}", arg), e); sawError = true; } } return sawError ? 1 : 0; } private  HadoopDelete(); static void main(String... args);  }### Answer:
@Test public void simple() throws Exception { File file = temporary.newFile(); int status = HadoopDelete.exec(file.toURI().toString()); assertThat(status, is(0)); assertThat(file.exists(), is(false)); }
@Test public void recursive() throws Exception { File dir = temporary.newFolder(); File a = new File(dir, "a"); File b = new File(dir, "b"); File c = new File(dir, "c"); a.createNewFile(); b.createNewFile(); c.createNewFile(); int status = HadoopDelete.exec(dir.toURI().toString()); assertThat(status, is(0)); assertThat(dir.exists(), is(false)); }
@Test public void missing() throws Exception { File file = new File(temporary.getRoot(), "__MISSING__"); int status = HadoopDelete.exec(file.toURI().toString()); assertThat("exit with 0 even if target is missing", status, is(0)); }
@Test public void multiple() throws Exception { File a = temporary.newFile(); File b = temporary.newFile(); File c = temporary.newFile(); int status = HadoopDelete.exec(a.toURI().toString(), b.toURI().toString(), c.toURI().toString()); assertThat(status, is(0)); assertThat(a.exists(), is(false)); assertThat(b.exists(), is(false)); assertThat(c.exists(), is(false)); }