use of com.google.api.expr.v1alpha1.ParsedExpr in project cel-java by projectnessie.
the class PbObjectTest method newProtoObject.
@Test
void newProtoObject() {
ProtoTypeRegistry reg = newRegistry();
ParsedExpr parsedExpr = ParsedExpr.newBuilder().setSourceInfo(SourceInfo.newBuilder().addAllLineOffsets(Arrays.asList(1, 2, 3)).build()).build();
reg.registerMessage(parsedExpr);
Indexer obj = (Indexer) reg.nativeToValue(parsedExpr);
Indexer si = (Indexer) obj.get(stringOf("source_info"));
Indexer lo = (Indexer) si.get(stringOf("line_offsets"));
assertThat(lo.get(intOf(2)).equal(intOf(3))).isSameAs(True);
Indexer expr = (Indexer) obj.get(stringOf("expr"));
Indexer call = (Indexer) expr.get(stringOf("call_expr"));
assertThat(call.get(stringOf("function")).equal(stringOf(""))).isSameAs(True);
}
Aggregations