use of com.google.protobuf.util.JsonTestProto.TestMap in project curiostack by curioswitch.
the class MessageMarshallerTest method parserAcceptsNonQuotedObjectKey.
@Test
public void parserAcceptsNonQuotedObjectKey() throws Exception {
TestMap.Builder builder = TestMap.newBuilder();
mergeFromJson("{\n" + " int32ToInt32Map: {1: 2},\n" + " stringToInt32Map: {hello: 3}\n" + "}", builder);
TestMap message = builder.build();
assertEquals(2, message.getInt32ToInt32Map().get(1).intValue());
assertEquals(3, message.getStringToInt32Map().get("hello").intValue());
}
use of com.google.protobuf.util.JsonTestProto.TestMap in project curiostack by curioswitch.
the class MessageMarshallerTest method mapFields.
@Test
public void mapFields() throws Exception {
assertMatchesUpstream(JsonTestUtil.testMapAllTypes());
TestMap message = TestMap.newBuilder().putInt32ToInt32Map(1, 2).putInt32ToInt32Map(3, 4).build();
assertMatchesUpstream(message);
}
use of com.google.protobuf.util.JsonTestProto.TestMap in project curiostack by curioswitch.
the class MessageMarshallerTest method includingDefaultValueFields.
@Test
public void includingDefaultValueFields() throws Exception {
TestAllTypes message = TestAllTypes.getDefaultInstance();
assertMatchesUpstream(message);
assertMatchesUpstream(message, true, false, false);
TestMap mapMessage = TestMap.getDefaultInstance();
assertMatchesUpstream(mapMessage);
assertMatchesUpstream(mapMessage, true, false, false);
TestOneof oneofMessage = TestOneof.getDefaultInstance();
assertMatchesUpstream(oneofMessage);
assertMatchesUpstream(oneofMessage, true, false, false);
oneofMessage = TestOneof.newBuilder().setOneofInt32(42).build();
assertMatchesUpstream(oneofMessage);
assertMatchesUpstream(oneofMessage, true, false, false);
oneofMessage = TestOneof.newBuilder().setOneofNullValue(NullValue.NULL_VALUE).build();
assertMatchesUpstream(oneofMessage);
assertMatchesUpstream(oneofMessage, true, false, false);
}
Aggregations