use of com.google.api.expr.v1alpha1.Type.ListType in project cel-java by projectnessie.
the class PbTypeDescriptionTest method checkedType.
@Test
void checkedType() {
Db pbdb = newDb();
TestAllTypes msg = TestAllTypes.getDefaultInstance();
String msgName = msg.getDescriptorForType().getFullName();
pbdb.registerMessage(msg);
PbTypeDescription td = pbdb.describeType(msgName);
assertThat(td).isNotNull();
FieldDescription field = td.fieldByName("map_string_string");
assertThat(field).isNotNull();
Type mapType = Decls.newMapType(Decls.String, Decls.String);
assertThat(field.checkedType()).isEqualTo(mapType);
field = td.fieldByName("repeated_nested_message");
assertThat(field).isNotNull();
Type listType = Decls.newListType(Decls.newObjectType("google.api.expr.test.v1.proto3.TestAllTypes.NestedMessage"));
assertThat(field.checkedType()).isEqualTo(listType);
}
use of com.google.api.expr.v1alpha1.Type.ListType in project cel-java by projectnessie.
the class JacksonTypeDescriptionTest method checkListType.
private void checkListType(JacksonRegistry reg, String prop, Class<?> valueClass, com.google.api.expr.v1alpha1.Type valueType) {
JacksonFieldType ft = (JacksonFieldType) reg.findFieldType(CollectionsObject.class.getName(), prop);
assertThat(ft).isNotNull();
JavaType javaType = ft.propertyWriter().getType();
assertThat(javaType).extracting(JavaType::isCollectionLikeType).isEqualTo(true);
assertThat(javaType.getContentType()).extracting(JavaType::getRawClass).isSameAs(valueClass);
assertThat(ft.type).extracting(com.google.api.expr.v1alpha1.Type::getListType).extracting(ListType::getElemType).isSameAs(valueType);
}
Aggregations