@VisibleForTesting
  StandardContext addStaticDir(Tomcat tomcat, String contextPath, File dir) {
    try {
      fs.createOrCleanupDir(dir);
    } catch (IOException e) {
      throw new IllegalStateException(format("Fail to create or clean-up directory %s", dir.getAbsolutePath()), e);
    }

    return addContext(tomcat, contextPath, dir);
  }
@Test
  public void cleanup_static_directory_if_already_exists() throws Exception {
    File dir = temp.newFolder();
    FileUtils.touch(new File(dir, "foo.txt"));

    underTest.addStaticDir(tomcat, "/deploy", dir);

    assertThat(dir).isDirectory()
      .exists()
      .isEmptyDirectory();
  }