use of org.terasology.engine.entitySystem.entity.internal.PojoEntityPool in project Terasology by MovingBlocks.
the class PojoEntityManagerTest method testMoveToPool.
@Test
public void testMoveToPool() {
EntityRef entity = entityManager.create();
long id = entity.getId();
PojoEntityPool pool1 = new PojoEntityPool(entityManager);
PojoEntityPool pool2 = new PojoEntityPool(entityManager);
assertFalse(pool1.contains(id));
assertFalse(pool2.contains(id));
assertTrue(entityManager.moveToPool(id, pool1));
assertTrue(pool1.contains(id));
assertFalse(pool2.contains(id));
assertTrue(entityManager.moveToPool(id, pool2));
assertTrue(pool2.contains(id));
assertFalse(pool1.contains(id));
}
use of org.terasology.engine.entitySystem.entity.internal.PojoEntityPool in project Terasology by MovingBlocks.
the class PojoEntityPoolTest method setup.
@BeforeEach
public void setup() {
NetworkSystem networkSystem = mock(NetworkSystem.class);
when(networkSystem.getMode()).thenReturn(NetworkMode.NONE);
context.put(NetworkSystem.class, networkSystem);
EntitySystemSetupUtil.addReflectionBasedLibraries(context);
EntitySystemSetupUtil.addEntityManagementRelatedClasses(context);
entityManager = (PojoEntityManager) context.get(EntityManager.class);
pool = new PojoEntityPool(entityManager);
}
Aggregations