### Question:
SourceProjectImpl implements SourceProject { @Override public void saveAll() { PrettyPrinterConfiguration prettyPrinterConfiguration = new PrettyPrinterConfiguration(); prettyPrinterConfiguration.setIndent("\t"); prettyPrinterConfiguration.setPrintComments(true); prettyPrinterConfiguration.setPrintJavadoc(true); prettyPrinterConfiguration.setOrderImports(true); PrettyPrinter prettyPrinter = new PrettyPrinter(prettyPrinterConfiguration); JavaFormatterOptions javaFormatterOptions = JavaFormatterOptions.builder().style(JavaFormatterOptions.Style.GOOGLE).build(); sourceRoot.setPrinter(googleCodeFormatter(javaFormatterOptions, prettyPrinter::print)); sourceRoot.saveAll(sourceRoot.getRoot()); } SourceProjectImpl(Path outputLocation);  SourceProjectImpl(SourceRoot sourceRoot); @Override void addCompilationUnit(String packageName, String name, CompilationUnit compilationUnit); @Override void saveAll();  }### Answer:
@Test public void testSaveAll() throws IOException { CompilationUnit compilationUnit = new CompilationUnit(); ClassOrInterfaceDeclaration classDeclaration = compilationUnit.addClass("TestClass"); classDeclaration.addPrivateField("FieldType", "fieldName").createGetter(); Path path = Files.createTempDirectory("cdt-test-dir"); sourceProject = new SourceProjectImpl(path); sourceProject.addCompilationUnit("com.github.kklisura", "TestClass", compilationUnit); sourceProject.saveAll(); File file = path.resolve("com/github/kklisura/TestClass.java").toFile(); assertNotNull(file); try { FileInputStream fileInputStream = new FileInputStream(file); int length; byte[] buffer = new byte[1024]; ByteArrayOutputStream result = new ByteArrayOutputStream(); while ((length = fileInputStream.read(buffer)) != -1) { result.write(buffer, 0, length); } String outputFile = result.toString("UTF-8"); assertEquals( "public class TestClass {\n" + "\n" + " private FieldType fieldName;\n" + "\n" + " public FieldType getFieldName() {\n" + " return fieldName;\n" + " }\n" + "}\n", outputFile); } finally { file.delete(); } }