### Question:
Mapper { public <I> I newFlyweight(Class<I> implementationParent, String templateFileName, Object... args) { Template template = Template.fromFile(implementationParent, templateFileName); return newFlyweight(implementationParent, templateFileName, template, args); } Mapper(Class<S> structInterface, boolean debugEnabled); int getSizeInBytes(); I newFlyweight(Class<I> implementationParent, String templateFileName, Object... args); I newFlyweight(Class<I> implementationParent, String templateFileName, Template template, Object... args);  }### Answer:
@Test public void shouldBeAbleToReadAndWriteData() { Example writer = (Example) newFlyweight(); Example reader = (Example) newFlyweight(); writer.setFoo(5); assertEquals(5, reader.getFoo()); writer.setBar(6L); assertEquals(6L, reader.getBar()); }
@Test public void shouldBeAbleToMoveFlyweights() { Example writer = (Example) newFlyweight(); Example reader = (Example) newFlyweight(); StubFlyweight writeCursor = (StubFlyweight) writer; StubFlyweight readCursor = (StubFlyweight) reader; writeCursor.moveTo(startAddress + EXAMPLE_SIZE_IN_BYTES); readCursor.moveTo(startAddress + EXAMPLE_SIZE_IN_BYTES); writer.setFoo(5); assertEquals(5, reader.getFoo()); writer.setBar(6L); assertEquals(6L, reader.getBar()); }