/**
* Test the construction from a simple map.
*/
public void test_newFromMap() {
JSONObject jObject = null;
Exception ex = null;
HashMap map = new HashMap();
map.put("string", "This is a string");
map.put("null", null);
map.put("integer", new Integer(1));
map.put("bool", new Boolean(true));
// Load a JSON object from a map with JSONable values.
try{
System.setProperty("org.apache.wink.common.model.json.factory.impl", "org.apache.wink.json4j.compat.impl.ApacheJSONFactory");
JSONFactory factory = JSONFactory.newInstance();
jObject = factory.createJSONObject(map);
}catch(Exception ex1){
ex = ex1;
ex.printStackTrace();
}
assertTrue(jObject != null);
assertTrue(jObject.length() == 4);
assertTrue(ex == null);
}