use of com.google.api.generator.engine.ast.UnaryOperationExpr in project gapic-generator-java by googleapis.
the class ImportWriterVisitorTest method writeUnaryOperationExprImports_LogicalNot.
@Test
public void writeUnaryOperationExprImports_LogicalNot() {
MethodInvocationExpr expr = MethodInvocationExpr.builder().setStaticReferenceType(TypeNode.withReference(ConcreteReference.withClazz(Expr.class))).setMethodName("isEmpty").setReturnType(TypeNode.BOOLEAN).build();
UnaryOperationExpr unaryOperationExpr = UnaryOperationExpr.logicalNotWithExpr(expr);
unaryOperationExpr.accept(writerVisitor);
assertEquals("import com.google.api.generator.engine.ast.Expr;\n\n", writerVisitor.write());
}
use of com.google.api.generator.engine.ast.UnaryOperationExpr in project gapic-generator-java by googleapis.
the class ImportWriterVisitorTest method writeUnaryOperationExprImports_PostIncrement.
@Test
public void writeUnaryOperationExprImports_PostIncrement() {
MethodInvocationExpr expr = MethodInvocationExpr.builder().setStaticReferenceType(TypeNode.withReference(ConcreteReference.withClazz(Expr.class))).setMethodName("getNumber").setReturnType(TypeNode.INT).build();
UnaryOperationExpr unaryOperationExpr = UnaryOperationExpr.postfixIncrementWithExpr(expr);
unaryOperationExpr.accept(writerVisitor);
assertEquals("import com.google.api.generator.engine.ast.Expr;\n\n", writerVisitor.write());
}
use of com.google.api.generator.engine.ast.UnaryOperationExpr in project gapic-generator-java by googleapis.
the class JavaWriterVisitorTest method writeUnaryOperationExpr_postfixIncrement.
@Test
public void writeUnaryOperationExpr_postfixIncrement() {
VariableExpr variableExpr = VariableExpr.withVariable(Variable.builder().setType(TypeNode.INT).setName("i").build());
UnaryOperationExpr postIncrementOperationExpr = UnaryOperationExpr.postfixIncrementWithExpr(variableExpr);
postIncrementOperationExpr.accept(writerVisitor);
assertThat(writerVisitor.write()).isEqualTo("i++");
}
use of com.google.api.generator.engine.ast.UnaryOperationExpr in project gapic-generator-java by googleapis.
the class JavaWriterVisitorTest method writeUnaryOperationExpr_logicalNot.
@Test
public void writeUnaryOperationExpr_logicalNot() {
MethodInvocationExpr methodInvocationExpr = MethodInvocationExpr.builder().setMethodName("isEmpty").setReturnType(TypeNode.BOOLEAN).build();
UnaryOperationExpr logicalNotOperationExpr = UnaryOperationExpr.logicalNotWithExpr(methodInvocationExpr);
logicalNotOperationExpr.accept(writerVisitor);
assertThat(writerVisitor.write()).isEqualTo("!isEmpty()");
}
Aggregations