### Question:
AWSConfiguration { public JSONObject optJsonObject(String key) { try { JSONObject value = this.mJSONObject.getJSONObject(key); if (value.has(this.configName)) { value = value.getJSONObject(this.configName); } return new JSONObject(value.toString()); } catch (JSONException je) { return null; } } AWSConfiguration(JSONObject jsonObject);  AWSConfiguration(JSONObject jsonObject, String configName);  AWSConfiguration(Context context);  AWSConfiguration(Context context, int configResourceId);  AWSConfiguration(Context context, int configResourceId,
            String configName); JSONObject optJsonObject(String key); String getUserAgent(); String getUserAgentOverride(); void setConfiguration(String configurationName); String getConfiguration(); @Override String toString();  }### Answer:
@Test public void testAWSConfigurationWithJSONObject() { try { JSONObject jsonObject = new JSONObject(jsonString); AWSConfiguration awsConfiguration = new AWSConfiguration(jsonObject); assertNotNull(awsConfiguration); assertNotNull(awsConfiguration.optJsonObject("AppSync")); assertEquals("API_KEY", awsConfiguration.optJsonObject("AppSync").getString("AuthMode")); } catch (JSONException e) { fail("Error in constructing AWSConfiguration." + e.getLocalizedMessage()); } }