public void tearDown() throws Exception {

    if (outFile != null && outFile.exists() && !outFile.delete()) {

      log.warn("Could not delete file: " + outFile);
    }

    super.tearDown();

    // clear references.
    outFile = null;
    tmpDir = null;
  }
  public void setUp() throws Exception {

    super.setUp();

    // random choice.
    bufferNodes = r.nextBoolean();

    outFile = new File(getName() + ".seg");

    if (outFile.exists() && !outFile.delete()) {

      throw new RuntimeException("Could not delete file: " + outFile);
    }

    tmpDir = outFile.getAbsoluteFile().getParentFile();
  }