FileWriter { public FileWriter atomicWrite(boolean atomicWrite) { this.atomicWrite = atomicWrite; return this; } FileWriter(Path path);  FileWriter(Path path, Supplier<String> contentProducer);  FileWriter(Path path, ByteArraySupplier contentProducer); private  FileWriter(Path path, Optional<ByteArraySupplier> contentProducer); Path path(); FileWriter withOwner(String owner); FileWriter withGroup(String group); FileWriter withPermissions(String permissions); FileWriter atomicWrite(boolean atomicWrite); FileWriter onlyIfFileDoesNotAlreadyExist(); boolean converge(TaskContext context); boolean converge(TaskContext context, String utf8Content); boolean converge(TaskContext context, byte[] content);  }
@Test public void testAtomicWrite() { FileWriter writer = new FileWriter(fileSystem.getPath("/foo/bar")) .atomicWrite(true); assertTrue(writer.converge(context, "content")); verify(context).recordSystemModification(any(), eq("Creating file /foo/bar")); assertEquals("content", new UnixPath(writer.path()).readUtf8File()); }