Search in sources :

Example 1 with LegoPlatformMessage

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();
}
Also used : RoboSystem(com.robo4j.core.RoboSystem) Configuration(com.robo4j.core.configuration.Configuration) LegoPlatformMessage(com.robo4j.units.lego.platform.LegoPlatformMessage) Test(org.junit.Test)

Aggregations

RoboSystem (com.robo4j.core.RoboSystem)1 Configuration (com.robo4j.core.configuration.Configuration)1 LegoPlatformMessage (com.robo4j.units.lego.platform.LegoPlatformMessage)1 Test (org.junit.Test)1