+ @Test
+ public void Construct_JSONObject_From_A_Subset_Of_Values_From_Another_JSONObject()
+ throws Exception {
+ Map<String, Object> map = new HashMap<>();
+ map.put("key1", "value1");
+ map.put("key2", "value2");
+ map.put("key3", "value3");
+ LOGJSONObject ljo= new LOGJSONObject(map);
+ String[] sA = {"key1", "key3"};
+ LOGJSONObject logJObject = new LOGJSONObject(ljo, sA);
+ assertThat(logJObject.toString(), is("{\"key1\":\"value1\",\"key3\":\"value3\"}"));
+ }
+
+ @Test
+ public void Construct_JSONObject_From_A_JSONTokener()
+ throws Exception {
+ JSONTokener x = new JSONTokener("{\"key1\":\"value1\",\"key3\":\"value3\"}");
+ LOGJSONObject logJObject = new LOGJSONObject(x);
+ assertThat(logJObject.toString(), is("{\"key1\":\"value1\",\"key3\":\"value3\"}"));
+ }
+
+ @Test
+ public void Construct_JSONObject_From_A_Bean_Object_And_Populate_From_Its_Getters_And_Setters()
+ throws Exception {
+ Map<String, Object> map = new HashMap<>();
+ map.put("key1", "value1");
+ map.put("key2", "value2");
+ map.put("key3", "value3");
+ Object bean = map;
+ LOGJSONObject logJObject = new LOGJSONObject(bean);
+ assertThat(logJObject.toString(), is("{\"empty\":false}"));
+ }
+