@Test @Override public void testAbstractClass() throws Exception { TemplateRegistry registry = new TemplateRegistry(null); ReflectionBeansTemplateBuilder builder = new ReflectionBeansTemplateBuilder(registry); try { builder.buildTemplate(AbstractClass.class); } catch (Throwable t) { assertTrue(t instanceof TemplateBuildException); } }
@Override public void testReferenceTypeFieldsClass(ReferenceTypeFieldsClass v) throws Exception { MessagePack msgpack = new MessagePack(); TemplateRegistry registry = new TemplateRegistry(null); ReflectionBeansTemplateBuilder builder = new ReflectionBeansTemplateBuilder(registry); Template<ReferenceTypeFieldsClass> tmpl = builder.buildTemplate(ReferenceTypeFieldsClass.class); BufferPacker packer = msgpack.createBufferPacker(); tmpl.write(packer, v); byte[] bytes = packer.toByteArray(); Unpacker unpacker = msgpack.createUnpacker(new ByteArrayInputStream(bytes)); unpacker.resetReadByteCount(); ReferenceTypeFieldsClass ret = tmpl.read(unpacker, null); assertEquals(v, ret); assertEquals(bytes.length, unpacker.getReadByteCount()); }