use of ilargia.entitas.index.PrimaryEntityIndex in project Entitas-Java by Rubentxu.
the class ContextTest method entityIndexTest.
@Test
public void entityIndexTest() {
entity.addComponent(TestComponentIds.Position, new Position());
Group group = context.getGroup(TestMatcher.Position());
PrimaryEntityIndex<Entity, String> index = new PrimaryEntityIndex("", (e, c) -> "positionEntities", group);
context.addEntityIndex("positions", index);
index = (PrimaryEntityIndex<Entity, String>) context.getEntityIndex("positions");
assertNotNull(index);
assertNotNull(index.getEntity("positionEntities"));
}
use of ilargia.entitas.index.PrimaryEntityIndex in project Entitas-Java by Rubentxu.
the class ContextTest method duplicateEntityIndexTest.
@Test(expected = ContextEntityIndexDoesAlreadyExistException.class)
public void duplicateEntityIndexTest() {
entity.addComponent(TestComponentIds.Position, new Position());
Group group = context.getGroup(TestMatcher.Position());
PrimaryEntityIndex<Entity, String> index = new PrimaryEntityIndex("", group, (e, c) -> new String[] { "positionEntities" });
context.addEntityIndex("duplicate", index);
context.addEntityIndex("duplicate", index);
}
Aggregations