RequestObjectHelper { public static boolean getShowTypes(final JSONObject requestObject) { final JSONObject rexsterRequestObject = getRexsterRequest(requestObject); if (rexsterRequestObject != null) { try { return rexsterRequestObject.getBoolean(Tokens.SHOW_TYPES); } catch (JSONException e) { return false; } } else { return false; } }  static JSONObject getRexsterRequest(final JSONObject requestObject); static Set<String> getReturnKeys(final JSONObject requestObject); static Set<String> getReturnKeys(final JSONObject requestObject, final String wildcard); static Set<String> getReturnKeys(final JSONArray arrayOfKeys, final String wildcard); static boolean getShowTypes(final JSONObject requestObject); static Long getStartOffset(final JSONObject requestObject); static Long getEndOffset(final JSONObject requestObject); static boolean hasElementProperties(final JSONObject requestObject); static void buildQueryProperties(final JSONObject requestObject, final VertexQuery query);  }
@Test public void getShowTypesNoKey() { JSONObject jsonWithNoShowTypesKey = new JSONObject(); Assert.assertFalse(RequestObjectHelper.getShowTypes(jsonWithNoShowTypesKey)); }
@Test public void getShowTypesBadValue() { JSONObject jsonWithNonBooleanValueForKey = buildJSONObjectFromString("{\"rexster\": { \"showTypes\": \"not-true-or-false\"}}"); Assert.assertFalse(RequestObjectHelper.getShowTypes(jsonWithNonBooleanValueForKey)); }
@Test public void getShowTypesValid() { JSONObject jsonWithBooleanValueForKey = buildJSONObjectFromString("{\"rexster\": { \"showTypes\": true}}"); Assert.assertTrue(RequestObjectHelper.getShowTypes(jsonWithBooleanValueForKey)); }