@Test public void convertToJsonTest() throws MalformedObjectNameException, AttributeNotFoundException { File file = new File("myFile"); Map ret = (Map) converter.convertToJson(file, null, JsonConvertOptions.DEFAULT); assertEquals(ret.get("name"), "myFile"); String name = (String) converter.convertToJson(file, Arrays.asList("name"), JsonConvertOptions.DEFAULT); assertEquals(name, "myFile"); }
@Test public void convertTransientValue() throws AttributeNotFoundException { TransientValueBean bean = new TransientValueBean(); bean.value = "value"; bean.transientValue = "transient"; Map ret = (Map) converter.convertToJson(bean, null, JsonConvertOptions.DEFAULT); assertNull(ret.get("transientValue")); assertEquals(ret.get("value"), "value"); }