Skip to content
This repository was archived by the owner on Jan 22, 2019. It is now read-only.

Commit 2cd937a

Browse files
committed
Fix #41
1 parent ddb480e commit 2cd937a

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

release-notes/VERSION

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ Project: jackson-dataformat-avro
44
= Releases
55
------------------------------------------------------------------------
66

7+
2.6.6 (not yet released)
8+
9+
#41: Problems with type `Number`, with schema
10+
711
2.6.5 (19-Jan-2016)
812

913
No changes since 2.6.4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.fasterxml.jackson.dataformat.avro;
2+
3+
public class NumberTest extends AvroTestBase
4+
{
5+
static class NumberWrapper {
6+
public Number value;
7+
8+
public NumberWrapper() { }
9+
public NumberWrapper(Number v) { value = v; }
10+
}
11+
12+
// for [dataformat-avro#41]
13+
public void testNumberType() throws Exception
14+
{
15+
AvroMapper mapper = new AvroMapper();
16+
AvroSchema schema = mapper.schemaFor(NumberWrapper.class);
17+
18+
byte[] bytes = mapper.writer(schema)
19+
.writeValueAsBytes(new NumberWrapper(Integer.valueOf(17)));
20+
NumberWrapper result = mapper.readerFor(NumberWrapper.class)
21+
.with(schema)
22+
.readValue(bytes);
23+
assertNotNull(result);
24+
assertEquals(Integer.valueOf(17), result.value);
25+
}
26+
}

0 commit comments

Comments
 (0)