// regular factory can't do it, without a call to setCodec()
JsonFactory jf = new JsonFactory();
try {
StringWriter sw = new StringWriter();
JsonGenerator gen = jf.createGenerator(sw);
gen.writeObject(new Pojo());
gen.close();
fail("Expected an exception: got sw '"+sw.toString()+"'");
} catch (IllegalStateException e) {
verifyException(e, "No ObjectCodec defined");
}