### Question:
DeferredEntityProcessingSystem extends BaseEntitySystem { protected abstract void process(int e); DeferredEntityProcessingSystem(Aspect.Builder aspect, EntityProcessPrincipal principal);  DeferredEntityProcessingSystem(EntityProcessPrincipal principal);   }### Answer:
@Test public void DeferredSystem_EntityAdded_RegisteredWithPrincipal() { EntityProcessPrincipal principal = mock(EntityProcessPrincipal.class); final WorldConfiguration config = new WorldConfiguration(); config.setSystem(new TestDeferredSystem(Aspect.all(EmptyComponent.class), principal)); World w = new World(config); Entity myEntity = new EntityBuilder(w).with(EmptyComponent.class).build(); w.process(); verify(principal, times(1)).registerAgent(eq(myEntity.getId()), any(EntityProcessAgent.class)); }
@Test public void DeferredSystem_EntityRemoved_UnregisteredFromPrincipal() { EntityProcessPrincipal principal = mock(EntityProcessPrincipal.class); WorldConfiguration config = new WorldConfiguration(); config.setSystem(new TestDeferredSystem(Aspect.all(EmptyComponent.class), principal)); World w = new World(config); Entity myEntity = new EntityBuilder(w).with(EmptyComponent.class).build(); w.process(); w.deleteEntity(myEntity); w.process(); verify(principal, times(1)).unregisterAgent(eq(myEntity.getId()), any(EntityProcessAgent.class)); }