File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -268,6 +268,10 @@ public void enumAPI() {
268268 actualEnum = jsonObject .optEnum (MyEnumField .class , "strKey" , null );
269269 assertTrue ("opt null" , actualEnum == null );
270270
271+ // opt with default an index that does not exist
272+ actualEnum = jsonObject .optEnum (MyEnumField .class , "noKey" , null );
273+ assertTrue ("opt null" , actualEnum == null );
274+
271275 /**
272276 * Exercise the proposed enum API methods on JSONArray
273277 */
@@ -309,5 +313,10 @@ public void enumAPI() {
309313 // opt with default the wrong value
310314 actualEnum = jsonArray .optEnum (MyEnumField .class , 0 , null );
311315 assertTrue ("opt null" , actualEnum == null );
316+
317+ // opt with default an index that does not exist
318+ actualEnum = jsonArray .optEnum (MyEnumField .class , 3 , null );
319+ assertTrue ("opt null" , actualEnum == null );
320+
312321 }
313322}
You can’t perform that action at this time.
0 commit comments