use of com.robo4j.units.lego.platform.LegoPlatformMessage 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