Search in sources :

Example 1 with ParametersWrapper

use of com.gemserk.componentsengine.utils.ParametersWrapper in project commons-gdx by gemserk.

the class ParametersWithFallBackTest method shouldReturnObjectFromParametersFallbackIfNotFoundOnParametersWithDefaultValue.

@Test
public void shouldReturnObjectFromParametersFallbackIfNotFoundOnParametersWithDefaultValue() {
    ParametersWithFallBack parametersWithFallBack = new ParametersWithFallBack();
    Parameters parameters = new ParametersWrapper();
    parametersWithFallBack.setParameters(parameters);
    parametersWithFallBack.put("a", 100f);
    Float a = parametersWithFallBack.get("a", 500f);
    assertThat(a, IsEqual.equalTo(100f));
}
Also used : Parameters(com.gemserk.componentsengine.utils.Parameters) ParametersWrapper(com.gemserk.componentsengine.utils.ParametersWrapper) Test(org.junit.Test)

Example 2 with ParametersWrapper

use of com.gemserk.componentsengine.utils.ParametersWrapper in project commons-gdx by gemserk.

the class ParametersWithFallBackTest method shouldReturnObjectFromParametersIfFoundWithDefaultValue.

@Test
public void shouldReturnObjectFromParametersIfFoundWithDefaultValue() {
    ParametersWithFallBack parametersWithFallBack = new ParametersWithFallBack();
    Parameters parameters = new ParametersWrapper();
    parametersWithFallBack.setParameters(parameters);
    parameters.put("a", 100f);
    Float a = parametersWithFallBack.get("a", 500f);
    assertThat(a, IsEqual.equalTo(100f));
}
Also used : Parameters(com.gemserk.componentsengine.utils.Parameters) ParametersWrapper(com.gemserk.componentsengine.utils.ParametersWrapper) Test(org.junit.Test)

Example 3 with ParametersWrapper

use of com.gemserk.componentsengine.utils.ParametersWrapper in project commons-gdx by gemserk.

the class ParametersWithFallBackTest method shouldReturnDefaultValueIfObjectNotFound.

@Test
public void shouldReturnDefaultValueIfObjectNotFound() {
    ParametersWithFallBack parametersWithFallBack = new ParametersWithFallBack();
    Parameters parameters = new ParametersWrapper();
    parametersWithFallBack.setParameters(parameters);
    Float a = parametersWithFallBack.get("a", 500f);
    assertThat(a, IsEqual.equalTo(500f));
}
Also used : Parameters(com.gemserk.componentsengine.utils.Parameters) ParametersWrapper(com.gemserk.componentsengine.utils.ParametersWrapper) Test(org.junit.Test)

Example 4 with ParametersWrapper

use of com.gemserk.componentsengine.utils.ParametersWrapper in project commons-gdx by gemserk.

the class ParametersWithFallBackTest method shouldReturnObjectFromParametersIfFound.

@Test
public void shouldReturnObjectFromParametersIfFound() {
    ParametersWithFallBack parametersWithFallBack = new ParametersWithFallBack();
    Parameters parameters = new ParametersWrapper();
    parametersWithFallBack.setParameters(parameters);
    parameters.put("a", 100f);
    Float a = parametersWithFallBack.get("a");
    assertThat(a, IsEqual.equalTo(100f));
}
Also used : Parameters(com.gemserk.componentsengine.utils.Parameters) ParametersWrapper(com.gemserk.componentsengine.utils.ParametersWrapper) Test(org.junit.Test)

Example 5 with ParametersWrapper

use of com.gemserk.componentsengine.utils.ParametersWrapper in project commons-gdx by gemserk.

the class ParametersDelegateImplTest method shouldReturnParameterFromDelegate2.

@Test
public void shouldReturnParameterFromDelegate2() {
    ParametersWrapper parameters = new ParametersWrapper();
    parameters.put("a", "b");
    ParametersDelegateImpl parametersDelegate = new ParametersDelegateImpl();
    parametersDelegate.setDelegate(parameters);
    assertEquals("b", parametersDelegate.get("a", "c"));
}
Also used : ParametersWrapper(com.gemserk.componentsengine.utils.ParametersWrapper) Test(org.junit.Test)

Aggregations

ParametersWrapper (com.gemserk.componentsengine.utils.ParametersWrapper)15 Test (org.junit.Test)15 Parameters (com.gemserk.componentsengine.utils.Parameters)5 Entity (com.artemis.Entity)3 World (com.artemis.World)3 EntityFactory (com.gemserk.commons.artemis.templates.EntityFactory)3 EntityFactoryImpl (com.gemserk.commons.artemis.templates.EntityFactoryImpl)3 EntityTemplate (com.gemserk.commons.artemis.templates.EntityTemplate)3 ScriptComponent (com.gemserk.commons.artemis.components.ScriptComponent)1 SpatialComponent (com.gemserk.commons.artemis.components.SpatialComponent)1 Script (com.gemserk.commons.artemis.scripts.Script)1 ScriptJavaImpl (com.gemserk.commons.artemis.scripts.ScriptJavaImpl)1 HashMap (java.util.HashMap)1