@Test
public void getAsDecimalFromSwitch() {

    SwitchItem item = new SwitchItem("Test");
    item.setState(OnOffType.ON);
    assertEquals(new DecimalType(1), item.getStateAs(DecimalType.class));
    item.setState(OnOffType.OFF);
    assertEquals(new DecimalType(0), item.getStateAs(DecimalType.class));
}