ComponentBuilder { public abstract Component build(Element componentElement, String commandParam) throws InitializationException;  abstract Component build(Element componentElement, String commandParam); void setCommandFactory(CommandFactory commandFactory);  }
@Test public void testSensorBuilderOnSwitchSensor() throws Exception { Element sensor1001 = deployer.queryElementById(1001); Sensor s = sensorBuilder.build(sensor1001); s.start(); Assert.assertTrue(s.getSensorID() == 1001); Assert.assertTrue(s instanceof SwitchSensor); Assert.assertTrue(s.isRunning()); Assert.assertTrue(s.getProperties().size() == 0); }
@Test public void testSensorBuilderOnRangeSensor() throws Exception { Element sensor1008 = deployer.queryElementById(1008); RangeSensor s = (RangeSensor)sensorBuilder.build(sensor1008); Assert.assertTrue(s.getSensorID() == 1008); Assert.assertTrue(s.getMaxValue() == 100); Assert.assertTrue(s.getMinValue() == -20); Assert.assertNotNull(s.getProperties()); Assert.assertTrue(s.getProperties().containsKey(Sensor.RANGE_MAX_STATE)); Assert.assertTrue(s.getProperties().containsKey(Sensor.RANGE_MIN_STATE)); Assert.assertTrue(s.getProperties().get(Sensor.RANGE_MAX_STATE).equals("100")); Assert.assertTrue(s.getProperties().get(Sensor.RANGE_MIN_STATE).equals("-20")); }