use of net.sf.json.JSONSerializer in project pinpoint by naver.
the class JsonLibJSONSerializerIT method test.
@Test
public void test() throws Exception {
Method toJSON = JSONSerializer.class.getMethod("toJSON", Object.class);
Method toJava = JSONSerializer.class.getMethod("toJava", JSON.class);
String test = "{'string':'JSON'}";
JSON json = JSONSerializer.toJSON(test);
if (Modifier.isStatic(toJava.getModifiers())) {
toJava.invoke(null, json);
} else {
// JSONSerializer.toJava(JSON) of json-lib 2.0 and below is instance method.
toJava.invoke(new JSONSerializer(), json);
}
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
verifier.printCache();
verifier.verifyTrace(event(SERVICE_TYPE, toJSON, annotation(ANNOTATION_KEY, test.length())));
verifier.verifyTrace(event("JSON-LIB", toJava));
verifier.verifyTraceCount(0);
}
Aggregations