@Test
public void testOverwriteFile() throws IOException {

  assertTrue("Creating empty dst file", DST_FILE.createNewFile());
  
  OutputStream fos = new AtomicFileOutputStream(DST_FILE);
  
  assertTrue("Empty file still exists", DST_FILE.exists());
  fos.write(TEST_STRING.getBytes());
  fos.flush();
  
  // Original contents still in place
  assertEquals("", DFSTestUtil.readFile(DST_FILE));
  fos.close();
  // New contents replace original file
  String readBackData = DFSTestUtil.readFile(DST_FILE);
  assertEquals(TEST_STRING, readBackData);
}