Search in sources :

Example 6 with User

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

the class TestBoolSchema 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 bool, field=org.apache.servicecomb.foundation.protobuf.internal.model.Root:bool"));
    scbMap = new HashMap<>();
    scbMap.put("bool", new User());
    rootSerializer.serialize(scbMap);
}
Also used : User(org.apache.servicecomb.foundation.protobuf.internal.model.User) Test(org.junit.Test)

Example 7 with User

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

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 8 with User

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

the class TestStringSchema 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 string, field=org.apache.servicecomb.foundation.protobuf.internal.model.Root:string"));
    scbMap = new HashMap<>();
    scbMap.put("string", new User());
    rootSerializer.serialize(scbMap);
}
Also used : User(org.apache.servicecomb.foundation.protobuf.internal.model.User) Test(org.junit.Test)

Example 9 with User

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

the class TestBoolSchema 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 bool, field=org.apache.servicecomb.foundation.protobuf.internal.model.Root:bool"));
    scbMap = new HashMap<>();
    scbMap.put("bool", new User());
    rootSerializer.serialize(scbMap);
}
Also used : User(org.apache.servicecomb.foundation.protobuf.internal.model.User) Test(org.junit.Test)

Example 10 with User

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

the class TestStringSchema 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 string, field=org.apache.servicecomb.foundation.protobuf.internal.model.Root:string"));
    scbMap = new HashMap<>();
    scbMap.put("string", 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