use of org.terasology.engine.SimpleUri in project Terasology by MovingBlocks.
the class ComponentMetadataTest method testStaticFieldsIgnored.
@Test
public void testStaticFieldsIgnored() {
EntitySystemLibrary entitySystemLibrary = new EntitySystemLibrary(context, new TypeSerializationLibrary(reflectFactory, copyStrategies));
ComponentLibrary lib = entitySystemLibrary.getComponentLibrary();
lib.register(new SimpleUri("unittest:string"), StringComponent.class);
ComponentMetadata<StringComponent> metadata = lib.getMetadata(StringComponent.class);
assertNull(metadata.getField("STATIC_VALUE"));
}
use of org.terasology.engine.SimpleUri 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.engine.SimpleUri 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());
}
use of org.terasology.engine.SimpleUri in project Terasology by MovingBlocks.
the class MetadataBuilderTest method testInheritsFields.
@Test
public void testInheritsFields() throws Exception {
DefaultClassMetadata<Inheriting> metadata = new DefaultClassMetadata<>(new SimpleUri(), Inheriting.class, factory, copyStrategyLibrary);
assertNotNull(metadata);
assertEquals(2, metadata.getFieldCount());
assertNotNull(metadata.getField("name"));
assertNotNull(metadata.getField("value"));
assertNotNull(metadata.newInstance());
}
use of org.terasology.engine.SimpleUri in project Terasology by MovingBlocks.
the class MetadataBuilderTest method testPrivateField.
@Test
public void testPrivateField() throws Exception {
DefaultClassMetadata<PrivateField> metadata = new DefaultClassMetadata<>(new SimpleUri(), PrivateField.class, factory, copyStrategyLibrary);
assertNotNull(metadata);
assertEquals(1, metadata.getFieldCount());
FieldMetadata fieldMetadata = metadata.getField("name");
assertNotNull(fieldMetadata);
assertEquals(String.class, fieldMetadata.getType());
assertEquals("name", fieldMetadata.getName());
assertNotNull(metadata.newInstance());
}
Aggregations