Skip to content

Commit 080deb3

Browse files
committed
Merge pull request #1 from komamitsu/v07-value-impl-rev2-fix-jackson-test
Fix unit test errors
2 parents ca2fb1e + 5ba7366 commit 080deb3

File tree

5 files changed

+16
-92
lines changed

5 files changed

+16
-92
lines changed

msgpack-core/src/main/java/org/msgpack/value/Variable.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,9 +383,11 @@ public Variable setIntegerValue(long v) {
383383
public Variable setIntegerValue(BigInteger v) {
384384
if (0 <= v.compareTo(LONG_MIN) && v.compareTo(LONG_MAX) <= 0) {
385385
this.type = Type.LONG;
386+
this.accessor = integerAccessor;
386387
this.longValue = v.longValue();
387388
} else {
388389
this.type = Type.BIG_INTEGER;
390+
this.accessor = integerAccessor;
389391
this.objectValue = v;
390392
}
391393
return this;

msgpack-jackson/src/main/java/org/msgpack/jackson/dataformat/MessagePackExtensionType.java

Lines changed: 0 additions & 25 deletions
This file was deleted.

msgpack-jackson/src/main/java/org/msgpack/jackson/dataformat/MessagePackParser.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,12 @@ protected void _handleEOF() throws JsonParseException {}
220220
@Override
221221
public String getText() throws IOException, JsonParseException {
222222
// This method can be called for new BigInteger(text)
223-
return value.asRawValue().stringValue();
223+
if (value.isRawValue()) {
224+
return value.asRawValue().stringValue();
225+
}
226+
else {
227+
return value.toString();
228+
}
224229
}
225230

226231
@Override

msgpack-jackson/src/test/java/org/msgpack/jackson/dataformat/MessagePackExtensionTypeTest.java

Lines changed: 0 additions & 60 deletions
This file was deleted.

msgpack-jackson/src/test/java/org/msgpack/jackson/dataformat/MessagePackParserTest.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import org.msgpack.core.MessagePack;
1010
import org.msgpack.core.MessagePacker;
1111
import org.msgpack.core.buffer.OutputStreamBufferOutput;
12+
import org.msgpack.value.ExtensionValue;
1213

1314
import java.io.*;
1415
import java.math.BigDecimal;
@@ -19,6 +20,7 @@
1920
import java.util.List;
2021
import java.util.Map;
2122

23+
import static org.junit.Assert.assertArrayEquals;
2224
import static org.junit.Assert.assertEquals;
2325
import static org.junit.Assert.assertTrue;
2426
import static org.junit.Assert.assertNull;
@@ -142,9 +144,9 @@ else if (k.equals("bool")) {
142144
else if (k.equals("ext")) {
143145
// #9
144146
bitmap |= 1 << 10;
145-
MessagePackExtensionType extensionType = (MessagePackExtensionType) v;
146-
assertEquals(0, extensionType.extType());
147-
assertEquals(ByteBuffer.wrap(extPayload), extensionType.byteBuffer());
147+
ExtensionValue extensionValue = (ExtensionValue) v;
148+
assertEquals(0, extensionValue.getType());
149+
assertArrayEquals(extPayload, extensionValue.getData());
148150
}
149151
}
150152
assertEquals(0x7FF, bitmap);
@@ -249,9 +251,9 @@ else if (k.equals("child_map_age")) {
249251
// #10
250252
assertEquals(true, array.get(i++));
251253
// #11
252-
MessagePackExtensionType extensionType = (MessagePackExtensionType) array.get(i++);
253-
assertEquals(-1, extensionType.extType());
254-
assertEquals(ByteBuffer.wrap(extPayload), extensionType.byteBuffer());
254+
ExtensionValue extensionValue = (ExtensionValue) array.get(i++);
255+
assertEquals(-1, extensionValue.getType());
256+
assertArrayEquals(extPayload, extensionValue.getData());
255257
}
256258

257259
@Test

0 commit comments

Comments
 (0)