use of javax.measure.quantity.Temperature in project smarthome by eclipse.
the class QuantityTypeArithmeticGroupFunctionTest method testMaxFunctionQuantityTypeDifferentUnits.
@Test
public void testMaxFunctionQuantityTypeDifferentUnits() {
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>("113 °F")));
items.add(createNumberItem("TestItem4", Temperature.class, UnDefType.UNDEF));
items.add(createNumberItem("TestItem5", Temperature.class, new QuantityType<Temperature>("294.15 K")));
function = new QuantityTypeArithmeticGroupFunction.Max(Temperature.class);
State state = function.calculate(items);
assertEquals(new QuantityType<Temperature>("100 °C"), state);
}
use of javax.measure.quantity.Temperature in project smarthome by eclipse.
the class QuantityTypeArithmeticGroupFunctionTest method testSumFunctionQuantityTypeDifferentUnits.
@Test
public void testSumFunctionQuantityTypeDifferentUnits() {
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>("192.2 °F")));
items.add(createNumberItem("TestItem4", Temperature.class, UnDefType.UNDEF));
items.add(createNumberItem("TestItem5", Temperature.class, new QuantityType<Temperature>("395.56 K")));
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 testMaxFunctionQuantityTypeIncompatibleUnits.
@Test
public void testMaxFunctionQuantityTypeIncompatibleUnits() {
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<Pressure>("192.2 hPa")));
function = new QuantityTypeArithmeticGroupFunction.Max(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 testAvgFunctionQuantityTypeIncompatibleUnits.
@Test
public void testAvgFunctionQuantityTypeIncompatibleUnits() {
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.Avg(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 testMinFunctionQuantityTypeIncompatibleUnits.
@Test
public void testMinFunctionQuantityTypeIncompatibleUnits() {
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<Pressure>("192.2 hPa")));
function = new QuantityTypeArithmeticGroupFunction.Min(Temperature.class);
State state = function.calculate(items);
assertEquals(new QuantityType<Temperature>("23.54 °C"), state);
}
Aggregations