use of org.terasology.entitySystem.stubs.OwnerComponent in project Terasology by MovingBlocks.
the class OwnershipHelperTest method testListsOwnedEntities.
@Test
public void testListsOwnedEntities() {
EntityRef ownedEntity = entityManager.create();
OwnerComponent ownerComp = new OwnerComponent();
ownerComp.child = ownedEntity;
EntityRef ownerEntity = entityManager.create(ownerComp);
OwnershipHelper helper = new OwnershipHelper(entityManager.getComponentLibrary());
assertEqualsContent(Lists.newArrayList(ownedEntity), helper.listOwnedEntities(ownerEntity));
}
use of org.terasology.entitySystem.stubs.OwnerComponent in project Terasology by MovingBlocks.
the class ComponentMetadataTest method testOwnsReferencesPopulated.
@Test
public void testOwnsReferencesPopulated() {
EntitySystemLibrary entitySystemLibrary = new EntitySystemLibrary(context, new TypeSerializationLibrary(reflectFactory, copyStrategies));
ComponentLibrary lib = entitySystemLibrary.getComponentLibrary();
lib.register(new SimpleUri("unittest:owner"), OwnerComponent.class);
ComponentMetadata<OwnerComponent> metadata = lib.getMetadata(OwnerComponent.class);
assertTrue(metadata.isReferenceOwner());
}
use of org.terasology.entitySystem.stubs.OwnerComponent in project Terasology by MovingBlocks.
the class FieldMetadataTest method testOwnsAnnotationProcessed.
@Test
public void testOwnsAnnotationProcessed() throws NoSuchMethodException {
ComponentMetadata<OwnerComponent> classMetadata = new ComponentMetadata<>(new SimpleUri("unittest:owner"), OwnerComponent.class, factory, copyStrategyLibrary);
ComponentFieldMetadata metadata = classMetadata.getField("child");
assertTrue(metadata.isOwnedReference());
}
Aggregations