Add test coverage for passing null to JsonPrimitive constuctors
This commit is contained in:
parent
ab0821c83e
commit
a817604a41
@ -30,6 +30,29 @@ import java.math.BigInteger;
|
|||||||
*/
|
*/
|
||||||
public class JsonPrimitiveTest extends TestCase {
|
public class JsonPrimitiveTest extends TestCase {
|
||||||
|
|
||||||
|
public void testNulls() {
|
||||||
|
try {
|
||||||
|
new JsonPrimitive((Boolean) null);
|
||||||
|
fail();
|
||||||
|
} catch (NullPointerException ignored) {
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
new JsonPrimitive((Number) null);
|
||||||
|
fail();
|
||||||
|
} catch (NullPointerException ignored) {
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
new JsonPrimitive((String) null);
|
||||||
|
fail();
|
||||||
|
} catch (NullPointerException ignored) {
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
new JsonPrimitive((Character) null);
|
||||||
|
fail();
|
||||||
|
} catch (NullPointerException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void testBoolean() throws Exception {
|
public void testBoolean() throws Exception {
|
||||||
JsonPrimitive json = new JsonPrimitive(Boolean.TRUE);
|
JsonPrimitive json = new JsonPrimitive(Boolean.TRUE);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user