use of com.squareup.wire.protos.alltypes.AllTypes in project wire by square.
the class GsonTest method deserializationOfAllTypes.
@Test
public void deserializationOfAllTypes() {
AllTypes allTypes = createBuilder().build();
AllTypes parsed = gson.fromJson(JSON, AllTypes.class);
assertThat(parsed).isEqualTo(allTypes);
assertThat(parsed.toString()).isEqualTo(allTypes.toString());
assertThat(gson.toJson(parsed)).isEqualTo(gson.toJson(allTypes));
}
use of com.squareup.wire.protos.alltypes.AllTypes in project wire by square.
the class GsonTest method serializationOfAllTypes.
@Test
public void serializationOfAllTypes() {
AllTypes allTypes = createBuilder().build();
String json = gson.toJson(allTypes);
assertThat(json).isEqualTo(JSON);
}
use of com.squareup.wire.protos.alltypes.AllTypes in project wire by square.
the class TestAllTypes method testReadFromSlowSource.
@Test
public void testReadFromSlowSource() throws IOException {
byte[] data = adapter.encode(allTypes);
Source input = new SlowSource(new Buffer().write(data));
AllTypes parsed = adapter.decode(Okio.buffer(input));
assertThat(parsed).isEqualTo(allTypes);
assertThat(allTypes.ext_opt_bool).isEqualTo(Boolean.TRUE);
assertThat(allTypes.ext_rep_bool).isEqualTo(list(true));
assertThat(allTypes.ext_pack_bool).isEqualTo(list(true));
}
use of com.squareup.wire.protos.alltypes.AllTypes in project wire by square.
the class TestAllTypes method testReadLongMessages.
@Test
public void testReadLongMessages() throws IOException {
AllTypes allTypes = createAllTypes(50);
byte[] data = adapter.encode(allTypes);
AllTypes parsed = adapter.decode(data);
assertThat(parsed).isEqualTo(allTypes);
assertThat(allTypes.ext_opt_bool).isEqualTo(Boolean.TRUE);
assertThat(allTypes.ext_rep_bool).isEqualTo(list(true, 50));
assertThat(allTypes.ext_pack_bool).isEqualTo(list(true, 50));
}
use of com.squareup.wire.protos.alltypes.AllTypes in project wire by square.
the class TestAllTypes method testToString.
@Test
public void testToString() throws IOException {
byte[] data = adapter.encode(allTypes);
AllTypes parsed = adapter.decode(data);
assertThat(parsed.toString()).isEqualTo(TestAllTypesData.expectedToString);
}
Aggregations