Skip to content

Commit 0e4e59d

Browse files
committed
...
1 parent eb4082a commit 0e4e59d

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

jr-objects/src/test/java/com/fasterxml/jackson/jr/ob/PrimitiveArrayTest.java

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,24 +53,34 @@ public void testShortArrayRead() throws Exception {
5353
}
5454

5555
@Test
56-
public void testShortArrayArrayWrite() throws Exception {
56+
public void testShortArrayWrite() throws Exception {
5757
assertEquals(SHORT_ARRAY_JSON, JSON.std.asString(SHORT_ARRAY));
5858
}
5959

60+
private final static String INT_ARRAY_JSON = "[1,2,-2000,1000000,-999999999]";
61+
private final static int[] INT_ARRAY = new int[] {1,2,-2000,1000000,-999999999};
62+
6063
@Test
61-
public void testIntArray() throws Exception {
62-
final int[] input = new int[]{1, 2, 3, 25, 999};
63-
String json = JSON.std.asString(input);
64-
int[] result = JSON.std.beanFrom(int[].class, json);
65-
assertArrayEquals(input, result);
64+
public void testIntArrayRead() throws Exception {
65+
assertArrayEquals(INT_ARRAY, JSON.std.beanFrom(int[].class, INT_ARRAY_JSON));
6666
}
6767

6868
@Test
69-
public void testLongArray() throws Exception {
70-
final long[] input = new long[]{1L, 2L, 3L, 999999999999L, -999999999999L};
71-
String json = JSON.std.asString(input);
72-
long[] result = JSON.std.beanFrom(long[].class, json);
73-
assertArrayEquals(input, result);
69+
public void testIntArrayWrite() throws Exception {
70+
assertEquals(INT_ARRAY_JSON, JSON.std.asString(INT_ARRAY));
71+
}
72+
73+
private final static String LONG_ARRAY_JSON = "[1,-2,3,999999999999,-999999999999]";
74+
private final static long[] LONG_ARRAY = new long[] {1L,-2L,3L,999999999999L,-999999999999L};
75+
76+
@Test
77+
public void testLongArrayRead() throws Exception {
78+
assertArrayEquals(LONG_ARRAY, JSON.std.beanFrom(long[].class, LONG_ARRAY_JSON));
79+
}
80+
81+
@Test
82+
public void testLongArrayWrite() throws Exception {
83+
assertEquals(LONG_ARRAY_JSON, JSON.std.asString(LONG_ARRAY));
7484
}
7585

7686
@Test

release-notes/VERSION-2.x

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Modules:
1212
------------------------------------------------------------------------
1313

1414
#196: `float[]` and `double[]` are serialized to JSON as `{ }`
15-
(reported by Luke H)
15+
(contributed by Luke H)
1616

1717
2.20.0-rc1 (04-Aug-2025)
1818

0 commit comments

Comments
 (0)