### Question:
JavaClassBuilderImpl extends BaseBuilder implements JavaClassBuilder { @Override public void setJavaDoc(String comment) { if (StringUtils.isNotEmpty(comment)) { declaration.setJavadocComment( JavadocUtils.createJavadocComment(comment, INDENTATION_NO_INDENTATION)); } } JavaClassBuilderImpl(String packageName, String name, String annotationsPackage); @Override String getName(); @Override void setJavaDoc(String comment); @Override void addPrivateField(String name, String type, String description); @Override void addFieldAnnotation(String name, String annotationName); @Override void addAnnotation(String annotationName); @Override void generateGettersAndSetters(); @Override void addImport(String packageName, String object); static final Logger LOGGER; }### Answer:
@Test public void testBasicClass() throws IOException { Capture<CompilationUnit> compilationUnitCapture = Capture.newInstance(); sourceProject.addCompilationUnit( eq(PACKAGE_NAME), eq(CLASS_NAME), capture(compilationUnitCapture)); javaClassBuilder.setJavaDoc(""); replayAll(); javaClassBuilder.build(sourceProject); assertEquals( "package com.github.kklisura;\n" + "\n" + "public class ClassName {\n" + "}\n" + "", compilationUnitCapture.getValue().toString()); verifyAll(); }
@Test public void testSetJavadoc() throws IOException { Capture<CompilationUnit> compilationUnitCapture = Capture.newInstance(); sourceProject.addCompilationUnit( eq(PACKAGE_NAME), eq(CLASS_NAME), capture(compilationUnitCapture)); javaClassBuilder.setJavaDoc("Java doc."); replayAll(); javaClassBuilder.build(sourceProject); assertEquals( "package com.github.kklisura;\n" + "\n" + "\n" + "public class ClassName {\n" + "}\n", compilationUnitCapture.getValue().toString()); verifyAll(); }