use of org.eclipse.smarthome.core.library.items.NumberItem in project smarthome by eclipse.
the class ScriptEngineOSGiTest method testEqualsWithItemState.
@SuppressWarnings("null")
@Test
public void testEqualsWithItemState() throws ScriptExecutionException, ScriptParsingException {
Item numberItem = itemRegistry.get(NUMBER_ITEM_TEMPERATURE);
((NumberItem) numberItem).setState(new QuantityType<>("20 °C"));
assertTrue(runScript("NumberA.state == 20 [°C]"));
}
use of org.eclipse.smarthome.core.library.items.NumberItem in project smarthome by eclipse.
the class ScriptEngineOSGiTest method testGreaterThanWithItemState.
@SuppressWarnings("null")
@Test
public void testGreaterThanWithItemState() throws ScriptExecutionException, ScriptParsingException {
Item numberItem = itemRegistry.get(NUMBER_ITEM_TEMPERATURE);
((NumberItem) numberItem).setState(new QuantityType<>("20 °C"));
assertTrue(runScript("NumberA.state > 20 [°F]"));
}
use of org.eclipse.smarthome.core.library.items.NumberItem in project smarthome by eclipse.
the class ScriptEngineOSGiTest method testGreaterThan_Number_Number.
@Test
public void testGreaterThan_Number_Number() throws ScriptParsingException, ScriptExecutionException {
Item numberItem = itemRegistry.get(NUMBER_ITEM_DECIMAL);
((NumberItem) numberItem).setState(new DecimalType(20));
assertTrue(runScript("NumberB.state > new DecimalType(19)"));
}
use of org.eclipse.smarthome.core.library.items.NumberItem in project smarthome by eclipse.
the class ScriptEngineOSGiTest method testGreaterEqualsWithItemState.
@SuppressWarnings("null")
@Test
public void testGreaterEqualsWithItemState() throws ScriptExecutionException, ScriptParsingException {
Item numberItem = itemRegistry.get(NUMBER_ITEM_TEMPERATURE);
((NumberItem) numberItem).setState(new QuantityType<>("20 °C"));
assertTrue(runScript("NumberA.state >= 20 [°C]"));
}
use of org.eclipse.smarthome.core.library.items.NumberItem in project smarthome by eclipse.
the class ScriptEngineOSGiTest method testLessEqualsWithItemState.
@SuppressWarnings("null")
@Test
public void testLessEqualsWithItemState() throws ScriptExecutionException, ScriptParsingException {
Item numberItem = itemRegistry.get(NUMBER_ITEM_TEMPERATURE);
((NumberItem) numberItem).setState(new QuantityType<>("19 °F"));
assertTrue(runScript("NumberA.state <= 20 [°F]"));
}
Aggregations