use of com.gemserk.componentsengine.utils.ParametersWrapper in project commons-gdx by gemserk.
the class EntityTemplateTest method shouldUseDefaultParametersIfParameterMissingFromCustomParameters.
@Test
public void shouldUseDefaultParametersIfParameterMissingFromCustomParameters() {
ParametersWrapper weaponBulletParameters = new ParametersWrapper();
// damage and position parameters are missing, but they are on default parameters
EntityTemplate bulletTemplate = new BulletEntityTemplate();
EntityFactory entityFactory = new EntityFactoryImpl(new World());
Entity bullet = entityFactory.instantiate(bulletTemplate, weaponBulletParameters);
DamageComponent damageComponent = bullet.getComponent(DamageComponent.class);
assertThat(damageComponent.getDamage(), IsEqual.equalTo(5f));
}
use of com.gemserk.componentsengine.utils.ParametersWrapper in project commons-gdx by gemserk.
the class ParametersDelegateImplTest method shouldReturnParameterFromItself.
@Test
public void shouldReturnParameterFromItself() {
ParametersWrapper parameters = new ParametersWrapper();
ParametersDelegateImpl parametersDelegate = new ParametersDelegateImpl();
parametersDelegate.setDelegate(parameters);
parametersDelegate.put("a", "b");
assertEquals("b", parametersDelegate.get("a"));
assertNull(parameters.get("a"));
}
use of com.gemserk.componentsengine.utils.ParametersWrapper in project commons-gdx by gemserk.
the class ParametersDelegateImplTest method shouldReturnParameterFromItself2.
@Test
public void shouldReturnParameterFromItself2() {
ParametersWrapper parameters = new ParametersWrapper();
ParametersDelegateImpl parametersDelegate = new ParametersDelegateImpl();
parametersDelegate.setDelegate(parameters);
parametersDelegate.put("a", "b");
assertEquals("b", parametersDelegate.get("a", "c"));
assertNull(parameters.get("a"));
}
use of com.gemserk.componentsengine.utils.ParametersWrapper in project commons-gdx by gemserk.
the class ParametersDelegateImplTest method shouldReturnParameterFromDelegate.
@Test
public void shouldReturnParameterFromDelegate() {
ParametersWrapper parameters = new ParametersWrapper();
parameters.put("a", "b");
ParametersDelegateImpl parametersDelegate = new ParametersDelegateImpl();
parametersDelegate.setDelegate(parameters);
assertEquals("b", parametersDelegate.get("a"));
}
use of com.gemserk.componentsengine.utils.ParametersWrapper in project commons-gdx by gemserk.
the class ParametersDelegateImplTest method shouldReturnDefaultValue.
@Test
public void shouldReturnDefaultValue() {
ParametersWrapper parameters = new ParametersWrapper();
ParametersDelegateImpl parametersDelegate = new ParametersDelegateImpl();
parametersDelegate.setDelegate(parameters);
assertEquals("c", parametersDelegate.get("a", "c"));
}
Aggregations