use of com.fasterxml.jackson.dataformat.avro.interop.DummyRecord in project jackson-dataformats-binary by FasterXML.
the class RecordWithComplexTest method testRecordWithMapFields.
@Test
public void testRecordWithMapFields() throws IOException {
RecursiveDummyRecord original = new RecursiveDummyRecord("Hello", 12353, new DummyRecord("World", 234));
original.simpleMap.put("Hello World", 9682584);
//
RecursiveDummyRecord result = roundTrip(RecursiveDummyRecord.class, original);
//
assertThat(result).isEqualTo(original);
assertThat(result.simpleMap.get("Hello World")).isEqualTo(original.simpleMap.get("Hello World"));
}
use of com.fasterxml.jackson.dataformat.avro.interop.DummyRecord in project jackson-dataformats-binary by FasterXML.
the class RecordWithComplexTest method testRecordWithOptionalEnumField.
@Test
public void testRecordWithOptionalEnumField() {
RecursiveDummyRecord original = new RecursiveDummyRecord("Hello", 12353, new DummyRecord("World", 234));
original.optionalEnum = DummyEnum.SOUTH;
//
RecursiveDummyRecord result = roundTrip(RecursiveDummyRecord.class, original);
//
assertThat(result).isEqualTo(original);
}
use of com.fasterxml.jackson.dataformat.avro.interop.DummyRecord in project jackson-dataformats-binary by FasterXML.
the class RecordWithComplexTest method testRecordWithMissingRequiredEnumFields.
@Test
public void testRecordWithMissingRequiredEnumFields() {
RecursiveDummyRecord original = new RecursiveDummyRecord("Hello", 12353, new DummyRecord("World", 234));
original.requiredEnum = null;
//
try {
roundTrip(RecursiveDummyRecord.class, original);
fail("Should throw an exception");
} catch (JacksonException e) {
// sometimes we get this
assertThat(e).isInstanceOf(DatabindException.class);
} catch (AvroTypeException e) {
// sometimes (not wrapped)
;
}
}
Aggregations