use of com.robo4j.core.RoboSystem in project robo4j by Robo4J.
the class SchedulePeriodUnitTest method basicScheudlePeriodUnitTest.
@Test
public void basicScheudlePeriodUnitTest() throws ConfigurationException {
RoboSystem system = new RoboSystem();
Configuration config = ConfigurationFactory.createEmptyConfiguration();
SchedulePeriodUnit unit = new SchedulePeriodUnit(system, "schedulePeriodUnit");
config.setString("unit", "test");
config.setInteger("delay", 1);
config.setInteger("period", 1);
config.setString("timeUnit", "SECONDS");
unit.initialize(config);
Assert.assertTrue(unit.getState().equals(LifecycleState.INITIALIZED));
}
use of com.robo4j.core.RoboSystem in project robo4j by Robo4J.
the class SimpleTankUnitTests method simpleTankUnitMockTest.
@Test
public void simpleTankUnitMockTest() throws Exception {
RoboSystem system = new RoboSystem();
SimpleTankUnitMock tank = new SimpleTankUnitMock(system, "tank");
Configuration config = ConfigurationFactory.createEmptyConfiguration();
tank.onInitialization(config);
DefaultAttributeDescriptor<Boolean> descriptor = DefaultAttributeDescriptor.create(Boolean.class, "getStatus");
tank.onMessage(new LegoPlatformMessage("right"));
tank.onMessage(new LegoPlatformMessage("left"));
tank.onMessage(new LegoPlatformMessage("move"));
tank.onMessage(new LegoPlatformMessage("back"));
tank.onMessage(new LegoPlatformMessage("stop"));
Assert.assertTrue(tank.getAttribute(descriptor).get());
tank.shutdown();
}
Aggregations