@Test
public void getAsPercentFromSwitch() {

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