public void testWriterSuccess() throws IOException {
File target = new File(tmpdir, "target.txt");
final File tmp = new File(tmpdir, "target.txt.tmp");
createFile(target, "before");
assertEquals("before", getContent(target));
new AtomicFileWritingIdiom(target, new WriterStatement() {
@Override
public void write(Writer os) throws IOException {
os.write("after");
assertTrue("implementation of AtomicFileOutputStream has changed, update the test", tmp.exists());
}