gson-comments/gson/src/test/java/com/google/gson/jf/LenientCollectionCommaTest....

23 lines
600 B
Java

package com.google.gson.jf;
import com.google.gson.*;
import junit.framework.TestCase;
import java.util.*;
import static com.google.gson.jf.ExtraAssert.*;
public class LenientCollectionCommaTest extends TestCase {
private Gson lenient;
private static final String json = "{\"collection\": [1, 2,, 3, , , 4, 5,]}";
@Override
protected void setUp() throws Exception {
super.setUp();
lenient = new GsonBuilder().setLenient().create();
}
public void testElementSkipping() {
assertListEquals(List.of(1, 2, 3, 4, 5), lenient.fromJson(json, IntListBox.class).collection);
}
}