DAInterfaceMethodWriter extends AbstractDAWriter<T> { public T write() throws IOException { commons.appendAnnotations(annotations); commons.appendIndent(); appendReturnType(); commons.append(name); appendParams(params); commons.append(";"); commons.newLine(); return parent; } DAInterfaceMethodWriter(String name, DAType returnType, FileContext fileContext, int indentOffset, T parent); DAInterfaceMethodWriter<T> withAnnotations(@Nullable DAAnnotation... annotations); DAInterfaceMethodWriter<T> withAnnotations(@Nullable List<DAAnnotation> annotations); DAInterfaceMethodWriter<T> withParams(@Nullable DAParameter... params); DAInterfaceMethodWriter<T> withParams(@Nullable List<DAParameter> params); T write();  }
@Test public void method() throws Exception { FileContextTestImpl fileContext = new FileContextTestImpl(); methodWriter("name", "java.lang.String", fileContext).write(); assertThat(fileContext.getRes()) .isEqualTo(INDENT + "String name();" + LINE_SEPARATOR); }
@Test public void write_returns_parent_writer() throws Exception { FileContextTestImpl fileContext = new FileContextTestImpl(); DAWriter parent = new DAWriter() { }; DAInterfaceMethodWriter<DAWriter> classWriter = new DAInterfaceMethodWriter<DAWriter>("name", DATypeFactory.from(String.class), fileContext, 1, parent ); assertThat(classWriter.write()).isSameAs(parent); }