use of org.apache.servicecomb.foundation.protobuf.internal.model.CustomGeneric in project java-chassis by ServiceComb.
the class TestMessageSchema method generic.
@Test
public void generic() throws Throwable {
JavaType javaType = TypeFactory.defaultInstance().constructParametricType(CustomGeneric.class, User.class);
RootDeserializer<CustomGeneric<User>> genericDeserializer = protoMapper.createRootDeserializer("Root", javaType);
builder.setUser(ProtobufRoot.User.newBuilder().setName("name1").build());
check(genericDeserializer, mapRootDeserializer, rootSerializer, false);
@SuppressWarnings("unchecked") CustomGeneric<User> generic = (CustomGeneric<User>) scbRoot;
Assert.assertThat(generic.user, Matchers.instanceOf(User.class));
}
use of org.apache.servicecomb.foundation.protobuf.internal.model.CustomGeneric in project incubator-servicecomb-java-chassis by apache.
the class TestMessageSchema method generic.
@Test
public void generic() throws Throwable {
JavaType javaType = TypeFactory.defaultInstance().constructParametricType(CustomGeneric.class, User.class);
RootDeserializer<CustomGeneric<User>> genericDeserializer = protoMapper.createRootDeserializer("Root", javaType);
builder.setUser(ProtobufRoot.User.newBuilder().setName("name1").build());
check(genericDeserializer, mapRootDeserializer, rootSerializer, false);
@SuppressWarnings("unchecked") CustomGeneric<User> generic = (CustomGeneric<User>) scbRoot;
Assert.assertThat(generic.user, Matchers.instanceOf(User.class));
}
Aggregations