Search in sources :

Example 6 with RelationalOperationExpr

use of com.google.api.generator.engine.ast.RelationalOperationExpr in project gapic-generator-java by googleapis.

the class ImportWriterVisitorTest method writeRelationalOperationExprImports.

@Test
public void writeRelationalOperationExprImports() {
    MethodInvocationExpr lhsExpr = MethodInvocationExpr.builder().setStaticReferenceType(TypeNode.withReference(ConcreteReference.withClazz(Expr.class))).setMethodName("getSomething").setReturnType(TypeNode.STRING).build();
    TypeNode someType = TypeNode.withReference(VaporReference.builder().setName("SomeClass").setPakkage("com.google.api.generator.engine").build());
    MethodInvocationExpr rhsExpr = MethodInvocationExpr.builder().setMethodName("getName").setStaticReferenceType(someType).setReturnType(TypeNode.STRING).build();
    RelationalOperationExpr relationalOperationExpr = RelationalOperationExpr.equalToWithExprs(lhsExpr, rhsExpr);
    relationalOperationExpr.accept(writerVisitor);
    assertEquals(LineFormatter.lines("import com.google.api.generator.engine.SomeClass;\n", "import com.google.api.generator.engine.ast.Expr;\n\n"), writerVisitor.write());
}
Also used : RelationalOperationExpr(com.google.api.generator.engine.ast.RelationalOperationExpr) ReferenceConstructorExpr(com.google.api.generator.engine.ast.ReferenceConstructorExpr) LogicalOperationExpr(com.google.api.generator.engine.ast.LogicalOperationExpr) ValueExpr(com.google.api.generator.engine.ast.ValueExpr) EnumRefExpr(com.google.api.generator.engine.ast.EnumRefExpr) ReturnExpr(com.google.api.generator.engine.ast.ReturnExpr) NewObjectExpr(com.google.api.generator.engine.ast.NewObjectExpr) Expr(com.google.api.generator.engine.ast.Expr) TernaryExpr(com.google.api.generator.engine.ast.TernaryExpr) RelationalOperationExpr(com.google.api.generator.engine.ast.RelationalOperationExpr) UnaryOperationExpr(com.google.api.generator.engine.ast.UnaryOperationExpr) AssignmentExpr(com.google.api.generator.engine.ast.AssignmentExpr) VariableExpr(com.google.api.generator.engine.ast.VariableExpr) InstanceofExpr(com.google.api.generator.engine.ast.InstanceofExpr) ArithmeticOperationExpr(com.google.api.generator.engine.ast.ArithmeticOperationExpr) AnonymousClassExpr(com.google.api.generator.engine.ast.AnonymousClassExpr) LambdaExpr(com.google.api.generator.engine.ast.LambdaExpr) MethodInvocationExpr(com.google.api.generator.engine.ast.MethodInvocationExpr) ThrowExpr(com.google.api.generator.engine.ast.ThrowExpr) MethodInvocationExpr(com.google.api.generator.engine.ast.MethodInvocationExpr) TypeNode(com.google.api.generator.engine.ast.TypeNode) Test(org.junit.Test)

Aggregations

MethodInvocationExpr (com.google.api.generator.engine.ast.MethodInvocationExpr)6 RelationalOperationExpr (com.google.api.generator.engine.ast.RelationalOperationExpr)6 VariableExpr (com.google.api.generator.engine.ast.VariableExpr)5 ValueExpr (com.google.api.generator.engine.ast.ValueExpr)4 Test (org.junit.Test)4 AssignmentExpr (com.google.api.generator.engine.ast.AssignmentExpr)3 Expr (com.google.api.generator.engine.ast.Expr)3 LogicalOperationExpr (com.google.api.generator.engine.ast.LogicalOperationExpr)3 TypeNode (com.google.api.generator.engine.ast.TypeNode)3 EnumRefExpr (com.google.api.generator.engine.ast.EnumRefExpr)2 LambdaExpr (com.google.api.generator.engine.ast.LambdaExpr)2 NewObjectExpr (com.google.api.generator.engine.ast.NewObjectExpr)2 ReturnExpr (com.google.api.generator.engine.ast.ReturnExpr)2 TernaryExpr (com.google.api.generator.engine.ast.TernaryExpr)2 ThrowExpr (com.google.api.generator.engine.ast.ThrowExpr)2 BetaApi (com.google.api.core.BetaApi)1 AnnotationNode (com.google.api.generator.engine.ast.AnnotationNode)1 AnonymousClassExpr (com.google.api.generator.engine.ast.AnonymousClassExpr)1 ArithmeticOperationExpr (com.google.api.generator.engine.ast.ArithmeticOperationExpr)1 AssignmentOperationExpr (com.google.api.generator.engine.ast.AssignmentOperationExpr)1