Test to demonstrate that we've fixed issue 302.
http://code.google.com/p/google-gson/issues/detail?id=302
This commit is contained in:
parent
523f489863
commit
46a8e9b411
|
@ -24,6 +24,9 @@ import com.google.gson.JsonParseException;
|
||||||
import com.google.gson.common.TestTypes.BagOfPrimitives;
|
import com.google.gson.common.TestTypes.BagOfPrimitives;
|
||||||
import com.google.gson.common.TestTypes.ClassOverridingEquals;
|
import com.google.gson.common.TestTypes.ClassOverridingEquals;
|
||||||
|
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
@ -94,6 +97,16 @@ public class UncategorizedTest extends TestCase {
|
||||||
assertEquals(OperationType.OP2, base.opType);
|
assertEquals(OperationType.OP2, base.opType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test that trailing whitespace is ignored.
|
||||||
|
* http://code.google.com/p/google-gson/issues/detail?id=302
|
||||||
|
*/
|
||||||
|
public void testTrailingWhitespace() throws Exception {
|
||||||
|
List<Integer> integers = gson.fromJson("[1,2,3] \n\n ",
|
||||||
|
new TypeToken<List<Integer>>() {}.getType());
|
||||||
|
assertEquals(Arrays.asList(1, 2, 3), integers);
|
||||||
|
}
|
||||||
|
|
||||||
private enum OperationType { OP1, OP2 }
|
private enum OperationType { OP1, OP2 }
|
||||||
private static class Base {
|
private static class Base {
|
||||||
OperationType opType;
|
OperationType opType;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user