use of org.terasology.entitySystem.entity.EntityStore in project Terasology by MovingBlocks.
the class LocalChunkProviderTest method testCompleteUpdateGeneratesStoredEntitiesFromPrefab.
@Test
public void testCompleteUpdateGeneratesStoredEntitiesFromPrefab() throws Exception {
final Chunk chunk = mockChunkAt(0, 0, 0);
final Prefab prefab = mock(Prefab.class);
final ChunkProviderTestComponent testComponent = new ChunkProviderTestComponent();
final EntityStore entityStore = createEntityStoreWithPrefabAndComponents(prefab, testComponent);
final List<EntityStore> entityStores = Collections.singletonList(entityStore);
final ReadyChunkInfo readyChunkInfo = ReadyChunkInfo.createForNewChunk(chunk, new TShortObjectHashMap<>(), entityStores);
when(chunkFinalizer.completeFinalization()).thenReturn(readyChunkInfo);
final EntityRef mockEntity = mock(EntityRef.class);
when(entityManager.create(any(Prefab.class))).thenReturn(mockEntity);
chunkProvider.completeUpdate();
verify(entityManager).create(eq(prefab));
verify(mockEntity).addComponent(eq(testComponent));
}
use of org.terasology.entitySystem.entity.EntityStore in project Terasology by MovingBlocks.
the class LocalChunkProviderTest method testCompleteUpdateGeneratesStoredEntities.
@Test
public void testCompleteUpdateGeneratesStoredEntities() throws Exception {
final Chunk chunk = mockChunkAt(0, 0, 0);
final ChunkProviderTestComponent testComponent = new ChunkProviderTestComponent();
final EntityStore entityStore = createEntityStoreWithComponents(testComponent);
final List<EntityStore> entityStores = Collections.singletonList(entityStore);
final ReadyChunkInfo readyChunkInfo = ReadyChunkInfo.createForNewChunk(chunk, new TShortObjectHashMap<>(), entityStores);
when(chunkFinalizer.completeFinalization()).thenReturn(readyChunkInfo);
final EntityRef mockEntity = mock(EntityRef.class);
when(entityManager.create()).thenReturn(mockEntity);
chunkProvider.completeUpdate();
verify(mockEntity).addComponent(eq(testComponent));
}
Aggregations