use of com.alibaba.fastjson.JSONStreamAware in project fastjson by alibaba.
the class JSONSerializerTest method test_error.
public void test_error() throws Exception {
JSONException error = null;
try {
StringWriter out = new StringWriter();
JSONSerializer serializer = new JSONSerializer();
serializer.write(new JSONStreamAware() {
public void writeJSONString(Appendable out) throws IOException {
throw new IOException();
}
});
} catch (JSONException e) {
error = e;
}
Assert.assertNotNull(error);
}
use of com.alibaba.fastjson.JSONStreamAware in project fastjson by alibaba.
the class JSONSerializerTest method test_4.
public void test_4() throws Exception {
JSONSerializer serializer = new JSONSerializer();
serializer.write(new JSONStreamAware() {
public void writeJSONString(Appendable out) throws IOException {
out.append("abc");
}
});
Assert.assertEquals("abc", serializer.getWriter().toString());
}
Aggregations