@Test
public void testCleanupBeforeLaunch() throws Exception {

  Container container = mock(Container.class);
  java.nio.file.Path linkName = Paths.get("target/linkName");
  java.nio.file.Path target = Paths.get("target");
  //deletes the link if it already exists because of previous test failures
  FileUtils.deleteQuietly(linkName.toFile());
  Files.createSymbolicLink(linkName.toAbsolutePath(),
      target.toAbsolutePath());
  Map<Path, List<String>> localResources = new HashMap<>();
  localResources.put(new Path(target.toFile().getAbsolutePath()),
      Lists.newArrayList(linkName.toFile().getAbsolutePath()));
  when(container.getLocalizedResources())
      .thenReturn(localResources);
  when(container.getUser()).thenReturn(System.getProperty("user.name"));
  containerExecutor.cleanupBeforeRelaunch(container);
  Assert.assertTrue(!Files.exists(linkName));
}