|
13 | 13 | */
|
14 | 14 |
|
15 | 15 | package com.fasterxml.jackson.dataformat.ion;
|
16 |
| - |
| 16 | + |
17 | 17 | import com.fasterxml.jackson.core.JsonParser;
|
18 | 18 | import com.fasterxml.jackson.core.JsonToken;
|
19 | 19 | import com.fasterxml.jackson.core.ObjectReadContext;
|
20 |
| -import com.fasterxml.jackson.dataformat.ion.IonFactory; |
21 |
| -import com.fasterxml.jackson.dataformat.ion.IonParser; |
22 | 20 |
|
23 | 21 | import org.junit.Assert;
|
| 22 | +import software.amazon.ion.IonReader; |
24 | 23 | import software.amazon.ion.IonSystem;
|
25 | 24 | import software.amazon.ion.IonValue;
|
26 | 25 | import software.amazon.ion.system.IonSystemBuilder;
|
27 | 26 |
|
| 27 | +import java.io.IOException; |
28 | 28 | import java.math.BigInteger;
|
29 | 29 | import org.junit.Test;
|
30 | 30 |
|
@@ -58,4 +58,23 @@ public void testGetNumberType() throws Exception {
|
58 | 58 | Assert.assertEquals(JsonToken.VALUE_NUMBER_FLOAT, floatParser.nextToken());
|
59 | 59 | Assert.assertEquals(JsonParser.NumberType.DOUBLE, floatParser.getNumberType());
|
60 | 60 | }
|
| 61 | + |
| 62 | + @Test |
| 63 | + public void testFloatType() throws IOException |
| 64 | + { |
| 65 | + final ObjectReadContext ctxt = ObjectReadContext.empty(); |
| 66 | + |
| 67 | + final byte[] data = "{ score:0.291e0 }".getBytes(); |
| 68 | + IonSystem ion = IonSystemBuilder.standard().build(); |
| 69 | + final IonValue ionFloat = ion.newFloat(Float.MAX_VALUE); |
| 70 | + IonReader reader = ionFloat.getSystem().newReader(data, 0, data.length); |
| 71 | + // Find the object |
| 72 | + reader.next(); |
| 73 | + // Step into the object |
| 74 | + reader.stepIn(); |
| 75 | + // Step next. |
| 76 | + reader.next(); |
| 77 | + final IonParser floatParser = new IonFactory().createParser(ctxt, reader); |
| 78 | + Assert.assertEquals(JsonParser.NumberType.DOUBLE, floatParser.getNumberType()); |
| 79 | + } |
61 | 80 | }
|
0 commit comments