use of com.squareup.wire.protos.edgecases.OneField in project wire by square.
the class ParseTest method typeMismatchHonorsWireDeclaredType.
@Ignore("TODO(jwilson)")
@Test
public void typeMismatchHonorsWireDeclaredType() throws Exception {
// tag 1 / 3-byte length-delimited string: 0x109506
// (0x109506 is a well-formed proto message that sets tag 2 to 456).
ByteString data = ByteString.decodeHex("0a03109506");
OneField oneField = OneField.ADAPTER.decode(data.toByteArray());
assertThat(oneField).isEqualTo(new OneField.Builder().opt_int32(3).build());
}
use of com.squareup.wire.protos.edgecases.OneField in project wire by square.
the class ParseTest method unknownTagIgnored.
@Test
public void unknownTagIgnored() throws Exception {
// tag 1 / type 0: 456
// tag 2 / type 0: 789
ByteString data = ByteString.decodeHex("08c803109506");
OneField oneField = OneField.ADAPTER.decode(data.toByteArray());
OneField expected = new OneField.Builder().opt_int32(456).build();
assertThat(oneField).isNotEqualTo(expected);
assertThat(oneField.withoutUnknownFields()).isEqualTo(expected);
}
use of com.squareup.wire.protos.edgecases.OneField in project wire by square.
the class ParseTest method lastValueWinsForRepeatedValueOfNonrepeatedField.
@Test
public void lastValueWinsForRepeatedValueOfNonrepeatedField() throws Exception {
// tag 1 / type 0: 456
// tag 1 / type 0: 789
ByteString data = ByteString.decodeHex("08c803089506");
OneField oneField = OneField.ADAPTER.decode(data.toByteArray());
assertThat(new OneField.Builder().opt_int32(789).build()).isEqualTo(oneField);
}
Aggregations