DAClassMethodWriter extends AbstractDAWriter<T> { public T end() throws IOException { commons.appendIndent(); commons.append("}"); commons.newLine(); return parent; } DAClassMethodWriter(String name, DAType returnType, FileContext fileContext, int indentOffset, T parent); DAClassMethodWriter<T> withModifiers(@Nullable DAModifier... modifiers); DAClassMethodWriter<T> withAnnotations(@Nullable List<DAAnnotation> annotations); DAClassMethodWriter<T> withParams(@Nullable List<DAParameter> params); DAClassMethodWriter<T> start(); DAStatementWriter<DAClassMethodWriter<T>> newStatement(); T end();  }
@Test public void end_returns_parent_writer() throws Exception { FileContextTestImpl fileContext = new FileContextTestImpl(); DAWriter parent = new DAWriter() { }; DAClassMethodWriter<DAWriter> classWriter = new DAClassMethodWriter<DAWriter>("name", DATypeFactory.from(String.class), fileContext, 1, parent ); assertThat(classWriter.end()).isSameAs(parent); }