Search in sources :

Example 66 with SimpleUri

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"));
}
Also used : StringComponent(org.terasology.entitySystem.stubs.StringComponent) SimpleUri(org.terasology.engine.SimpleUri) TypeSerializationLibrary(org.terasology.persistence.typeHandling.TypeSerializationLibrary) Test(org.junit.Test)

Example 67 with SimpleUri

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());
}
Also used : OwnerComponent(org.terasology.entitySystem.stubs.OwnerComponent) SimpleUri(org.terasology.engine.SimpleUri) TypeSerializationLibrary(org.terasology.persistence.typeHandling.TypeSerializationLibrary) Test(org.junit.Test)

Example 68 with SimpleUri

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());
}
Also used : OwnerComponent(org.terasology.entitySystem.stubs.OwnerComponent) SimpleUri(org.terasology.engine.SimpleUri) Test(org.junit.Test)

Example 69 with SimpleUri

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());
}
Also used : DefaultClassMetadata(org.terasology.reflection.metadata.DefaultClassMetadata) SimpleUri(org.terasology.engine.SimpleUri) Test(org.junit.Test)

Example 70 with SimpleUri

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());
}
Also used : DefaultClassMetadata(org.terasology.reflection.metadata.DefaultClassMetadata) FieldMetadata(org.terasology.reflection.metadata.FieldMetadata) SimpleUri(org.terasology.engine.SimpleUri) Test(org.junit.Test)

Aggregations

SimpleUri (org.terasology.engine.SimpleUri)71 Test (org.junit.Test)18 Map (java.util.Map)10 Name (org.terasology.naming.Name)9 ResourceUrn (org.terasology.assets.ResourceUrn)7 DefaultClassMetadata (org.terasology.reflection.metadata.DefaultClassMetadata)7 Config (org.terasology.config.Config)6 Input (org.terasology.input.Input)6 FBO (org.terasology.rendering.opengl.FBO)6 ModuleManager (org.terasology.engine.module.ModuleManager)5 Command (org.terasology.logic.console.commandSystem.annotations.Command)5 ModuleEnvironment (org.terasology.module.ModuleEnvironment)5 List (java.util.List)4 DependencyResolver (org.terasology.module.DependencyResolver)4 ResolutionResult (org.terasology.module.ResolutionResult)4 UILabel (org.terasology.rendering.nui.widgets.UILabel)4 Lists (com.google.common.collect.Lists)3 IOException (java.io.IOException)3 Type (java.lang.reflect.Type)3 Locale (java.util.Locale)3