DAClassWriter extends AbstractDAWriter<T> { public T end() throws IOException { commons.appendIndent(); commons.append("}"); commons.newLine(); return parent; } DAClassWriter(DAType classType, FileContext fileContext, T parent, int indentOffset); DAClassWriter<T> withModifiers(@Nullable DAModifier... modifiers); DAClassWriter<T> withAnnotations(List<DAAnnotation> annotations); DAClassWriter<T> withImplemented(List<DAType> implemented); DAClassWriter<T> withExtended(DAType extended); DAClassWriter<T> start(); DAPropertyWriter<DAClassWriter<T>> newProperty(String name, DAType type); DAInitializedPropertyWriter<DAClassWriter<T>> newInitializedProperty(String name, DAType type); DAConstructorWriter<DAClassWriter<T>> newConstructor(); DAClassMethodWriter<DAClassWriter<T>> newMethod(String name, DAType returnType); T end(); DAClassWriter<DAClassWriter<T>> newClass(DAType classType);  }
@Test public void end_returns_parent_writer() throws Exception { FileContextTestImpl fileContext = new FileContextTestImpl(); DAWriter parent = new DAWriter() { }; DAClassWriter<DAWriter> classWriter = new DAClassWriter<DAWriter>(NAME_DATYPE, fileContext, parent, 1 ); assertThat(classWriter.end()).isSameAs(parent); }