use of javax.measure.quantity.Temperature in project smarthome by eclipse.
the class QuantityTypeArithmeticGroupFunctionTest method testSumFunctionQuantityTypeIncompatibleUnits.
@Test
public void testSumFunctionQuantityTypeIncompatibleUnits() {
// we need an ordered set to guarantee the Unit of the first entry
items = new LinkedHashSet<Item>();
items.add(createNumberItem("TestItem1", Temperature.class, new QuantityType<Temperature>("23.54 °C")));
items.add(createNumberItem("TestItem2", Temperature.class, UnDefType.NULL));
items.add(createNumberItem("TestItem3", Pressure.class, new QuantityType<Temperature>("192.2 hPa")));
function = new QuantityTypeArithmeticGroupFunction.Sum(Temperature.class);
State state = function.calculate(items);
assertEquals(new QuantityType<Temperature>("23.54 °C"), state);
}
use of javax.measure.quantity.Temperature in project smarthome by eclipse.
the class QuantityTypeArithmeticGroupFunctionTest method testMaxFunctionQuantityType.
@Test
public void testMaxFunctionQuantityType() {
items.add(createNumberItem("TestItem1", Temperature.class, new QuantityType<Temperature>("100 °C")));
items.add(createNumberItem("TestItem2", Temperature.class, UnDefType.NULL));
items.add(createNumberItem("TestItem3", Temperature.class, new QuantityType<Temperature>("200 °C")));
items.add(createNumberItem("TestItem4", Temperature.class, UnDefType.UNDEF));
items.add(createNumberItem("TestItem5", Temperature.class, new QuantityType<Temperature>("300 °C")));
function = new QuantityTypeArithmeticGroupFunction.Max(Temperature.class);
State state = function.calculate(items);
assertEquals(new QuantityType<Temperature>("300 °C"), state);
}
use of javax.measure.quantity.Temperature in project smarthome by eclipse.
the class QuantityTypeArithmeticGroupFunctionTest method testSumFunctionQuantityType.
@Test
public void testSumFunctionQuantityType() {
items.add(createNumberItem("TestItem1", Temperature.class, new QuantityType<Temperature>("23.54 °C")));
items.add(createNumberItem("TestItem2", Temperature.class, UnDefType.NULL));
items.add(createNumberItem("TestItem3", Temperature.class, new QuantityType<Temperature>("89 °C")));
items.add(createNumberItem("TestItem4", Temperature.class, UnDefType.UNDEF));
items.add(createNumberItem("TestItem5", Temperature.class, new QuantityType<Temperature>("122.41 °C")));
function = new QuantityTypeArithmeticGroupFunction.Sum(Temperature.class);
State state = function.calculate(items);
assertEquals(new QuantityType<Temperature>("234.95 °C"), state);
}
use of javax.measure.quantity.Temperature in project smarthome by eclipse.
the class QuantityTypeArithmeticGroupFunctionTest method testMinFunctionQuantityType.
@Test
public void testMinFunctionQuantityType() {
items.add(createNumberItem("TestItem1", Temperature.class, new QuantityType<Temperature>("100 °C")));
items.add(createNumberItem("TestItem2", Temperature.class, UnDefType.NULL));
items.add(createNumberItem("TestItem3", Temperature.class, new QuantityType<Temperature>("200 °C")));
items.add(createNumberItem("TestItem4", Temperature.class, UnDefType.UNDEF));
items.add(createNumberItem("TestItem5", Temperature.class, new QuantityType<Temperature>("300 °C")));
function = new QuantityTypeArithmeticGroupFunction.Min(Temperature.class);
State state = function.calculate(items);
assertEquals(new QuantityType<Temperature>("100 °C"), state);
}
Aggregations