use of com.google.api.generator.engine.ast.VaporReference in project gapic-generator-java by googleapis.
the class JavaWriterVisitorTest method writeThisObjectValue_methodReturn.
@Test
public void writeThisObjectValue_methodReturn() {
VaporReference ref = VaporReference.builder().setName("Student").setPakkage("com.google.example.v1").build();
TypeNode classType = TypeNode.withReference(ref);
MethodDefinition methodDefinition = MethodDefinition.builder().setName("apply").setScope(ScopeNode.PUBLIC).setReturnType(TypeNode.withReference(ref)).setReturnExpr(ValueExpr.builder().setValue(ThisObjectValue.withType(classType)).build()).build();
methodDefinition.accept(writerVisitor);
assertEquals(LineFormatter.lines("public Student apply() {\n", "return this;\n", "}\n\n"), writerVisitor.write());
}
Aggregations