use of com.google.protobuf.util.JsonTestProto.TestOneof 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);
}
use of com.google.protobuf.util.JsonTestProto.TestOneof in project curiostack by curioswitch.
the class MessageMarshallerTest method nullInOneOf.
@Test
public void nullInOneOf() throws Exception {
TestOneof.Builder builder = TestOneof.newBuilder();
mergeFromJson("{\n" + " \"oneofNullValue\": null \n" + "}", builder);
TestOneof message = builder.build();
assertEquals(TestOneof.OneofFieldCase.ONEOF_NULL_VALUE, message.getOneofFieldCase());
assertEquals(NullValue.NULL_VALUE, message.getOneofNullValue());
}
Aggregations