use of org.projectnessie.cel.common.types.TypeT.TypeType in project cel-java by projectnessie.
the class TypeTest method typeConvertToType.
@Test
void typeConvertToType() {
Type[] stdTypes = new Type[] { BoolType, BytesType, DoubleType, DurationType, IntType, ListType, MapType, NullType, StringType, TimestampType, TypeType, UintType };
for (Type stdType : stdTypes) {
Val cnv = stdType.convertToType(TypeType);
assertThat(cnv).isEqualTo(TypeType);
}
}
use of org.projectnessie.cel.common.types.TypeT.TypeType in project cel-java by projectnessie.
the class PbObjectTest method protoObjectConvertToType.
@Test
void protoObjectConvertToType() {
TypeRegistry reg = newRegistry(Expr.getDefaultInstance());
ParsedExpr msg = ParsedExpr.newBuilder().setSourceInfo(SourceInfo.newBuilder().addAllLineOffsets(Arrays.asList(1, 2, 3)).build()).build();
Val obj = reg.nativeToValue(msg);
assertThat(obj).isInstanceOf(ObjectT.class);
ObjectT objVal = (ObjectT) obj;
Type tv = objVal.type();
assertThat(objVal.convertToType(TypeType).equal(tv)).isSameAs(True);
assertThat(objVal.convertToType(objVal.type())).isSameAs(objVal);
}
Aggregations