File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed
avro/src/test/java/com/fasterxml/jackson/dataformat/avro/failing Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .dataformat .avro .failing ;
2
+
3
+ import org .apache .avro .Schema ;
4
+ import org .apache .avro .SchemaBuilder ;
5
+
6
+ import com .fasterxml .jackson .annotation .JsonAutoDetect ;
7
+
8
+ import com .fasterxml .jackson .dataformat .avro .AvroMapper ;
9
+ import com .fasterxml .jackson .dataformat .avro .AvroSchema ;
10
+ import com .fasterxml .jackson .dataformat .avro .AvroTestBase ;
11
+
12
+ public class EmptyRecordRead177Test extends AvroTestBase
13
+ {
14
+ private final AvroMapper MAPPER = getMapper ();
15
+
16
+ private Schema SCHEMA = SchemaBuilder
17
+ .builder (EmptyRecordRead177Test .class .getName () + "$" )
18
+ .record (Empty .class .getSimpleName ())
19
+ .fields ()
20
+ .endRecord ();
21
+
22
+ @ JsonAutoDetect // just a marker to avoid "no properties found" exception
23
+ static final class Empty {
24
+ @ Override
25
+ public boolean equals (Object o ) {
26
+ return o instanceof Empty ;
27
+ }
28
+ }
29
+
30
+ public void testEmptyRecord () throws Exception {
31
+ final Empty empty = new Empty ();
32
+
33
+ byte [] ser = MAPPER .writer ().with (new AvroSchema (SCHEMA )).writeValueAsBytes (empty );
34
+
35
+ final Empty result = MAPPER .readerFor (Empty .class )
36
+ .with (new AvroSchema (SCHEMA ))
37
+ .readValue (ser );
38
+
39
+ assertEquals (empty , result );
40
+ }
41
+ }
You can’t perform that action at this time.
0 commit comments