Search in sources :

Example 11 with User

use of org.apache.servicecomb.foundation.protobuf.internal.model.User in project incubator-servicecomb-java-chassis by apache.

the class TestRepeatedSchema method users.

@Test
public void users() throws Throwable {
    builder.addUsers(ProtobufRoot.User.newBuilder().setName("name1").build());
    builder.addUsers(ProtobufRoot.User.newBuilder().setName("name2").build());
    check();
    RootWithArray rootWithArray = new RootWithArray();
    rootWithArray.users = new User[] { new User("name1"), new User("name2") };
    Assert.assertArrayEquals(protobufBytes, rootSerializer.serialize(rootWithArray));
}
Also used : User(org.apache.servicecomb.foundation.protobuf.internal.model.User) Test(org.junit.Test)

Example 12 with User

use of org.apache.servicecomb.foundation.protobuf.internal.model.User in project incubator-servicecomb-java-chassis by apache.

the class TestBytesSchema method type_invalid.

@Test
public void type_invalid() throws Throwable {
    expectedException.expect(IllegalStateException.class);
    expectedException.expectMessage(Matchers.is("not support serialize from org.apache.servicecomb.foundation.protobuf.internal.model.User to proto bytes, field=org.apache.servicecomb.foundation.protobuf.internal.model.Root:bytes"));
    scbMap = new HashMap<>();
    scbMap.put("bytes", new User());
    rootSerializer.serialize(scbMap);
}
Also used : User(org.apache.servicecomb.foundation.protobuf.internal.model.User) Test(org.junit.Test)

Aggregations

User (org.apache.servicecomb.foundation.protobuf.internal.model.User)12 Test (org.junit.Test)12 JavaType (com.fasterxml.jackson.databind.JavaType)2 CustomGeneric (org.apache.servicecomb.foundation.protobuf.internal.model.CustomGeneric)2