|
| 1 | +package com.fasterxml.jackson.jr.ob; |
| 2 | + |
| 3 | +import static org.junit.Assert.assertArrayEquals; |
| 4 | + |
| 5 | +public class ReadIntArray7Test extends TestBase { |
| 6 | + public void testReadIntArray() throws Exception { |
| 7 | + final int[] input = new int[]{1, 2, 3, 25, 999}; |
| 8 | + String json = JSON.std.asString(input); |
| 9 | + int[] result = JSON.std.beanFrom(int[].class, json); |
| 10 | + assertArrayEquals(input, result); |
| 11 | + } |
| 12 | + |
| 13 | + public void testReadIntArray2() throws Exception { |
| 14 | + final int[][] input = new int[][]{{1, 2, 3, 25, 999},{456,678,789},{1},{},{1000,2000,3000}}; |
| 15 | + String json = JSON.std.asString(input); |
| 16 | + int[][] result = JSON.std.beanFrom(int[][].class, json); |
| 17 | + assertArrayEquals(input, result); |
| 18 | + } |
| 19 | + |
| 20 | + public void testReadIntArray3() throws Exception { |
| 21 | + final int[][][] input = new int[][][]{{{1, 2, 3, 25, 999},{6,7,3}},{{456}, {678, 789}},{},{{},{23}},{{}}}; |
| 22 | + String json = JSON.std.asString(input); |
| 23 | + int[][][] result = JSON.std.beanFrom(int[][][].class, json); |
| 24 | + assertArrayEquals(input, result); |
| 25 | + } |
| 26 | + |
| 27 | + public void testReadIntArrayWhenEmpty() throws Exception { |
| 28 | + final int[][][] input = new int[][][]{}; |
| 29 | + String json = JSON.std.asString(input); |
| 30 | + int[][][] result = JSON.std.beanFrom(int[][][].class, json); |
| 31 | + assertArrayEquals(input, result); |
| 32 | + } |
| 33 | +} |
0 commit comments