MapTypeNoProps<String, String> map1 = new MapTypeNoProps<String, String>();
map1.put("key1", "value1");
map1.put("key2", "value2");
JSONMarshaler.ALWAYS_USE_INNER_PROPERTY = false;
JSON json1 = JSONMarshaler.marshalObject(map1);
JSON jsonExpected1 = JSON.parse("{\"key2\":\"value2\",\"key1\":\"value1\"}");
System.out.println("Parsed:" + json1.toJSON());
System.out.println("Expected:" + jsonExpected1.toJSON());
assertTrue(json1.equals(jsonExpected1));
JSONMarshaler.ALWAYS_USE_INNER_PROPERTY = true;
JSON json2 = JSONMarshaler.marshalObject(map1);
JSON jsonExpected2 = JSON.parse("{\"$innerObject\":{\"key2\":\"value2\",\"key1\":\"value1\"}}");
System.out.println("Parsed:" + json2.toJSON());
System.out.println("Expected:" + jsonExpected2.toJSON());
assertTrue(json2.equals(jsonExpected2));
}