mirror of
https://github.com/ethauvin/JSON-java.git
synced 2025-06-17 07:50:52 -07:00
few more enum support tests
This commit is contained in:
parent
8ac8c34e9f
commit
1f4e836863
1 changed files with 9 additions and 0 deletions
|
@ -268,6 +268,10 @@ public class EnumTest {
|
|||
actualEnum = jsonObject.optEnum(MyEnumField.class, "strKey", null);
|
||||
assertTrue("opt null", actualEnum == null);
|
||||
|
||||
// opt with default an index that does not exist
|
||||
actualEnum = jsonObject.optEnum(MyEnumField.class, "noKey", null);
|
||||
assertTrue("opt null", actualEnum == null);
|
||||
|
||||
/**
|
||||
* Exercise the proposed enum API methods on JSONArray
|
||||
*/
|
||||
|
@ -309,5 +313,10 @@ public class EnumTest {
|
|||
// opt with default the wrong value
|
||||
actualEnum = jsonArray.optEnum(MyEnumField.class, 0, null);
|
||||
assertTrue("opt null", actualEnum == null);
|
||||
|
||||
// opt with default an index that does not exist
|
||||
actualEnum = jsonArray.optEnum(MyEnumField.class, 3, null);
|
||||
assertTrue("opt null", actualEnum == null);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue