StringItem extends GenericItem { @Override public void setState(State state) { if (isAcceptedState(acceptedDataTypes, state)) { super.setState(state); } else { logSetTypeError(state); } } StringItem(String name); void send(StringType command); @Override List<Class<? extends State>> getAcceptedDataTypes(); @Override List<Class<? extends Command>> getAcceptedCommandTypes(); @Override T getStateAs(Class<T> typeClass); @Override void setState(State state);  }
@Test public void setStringType() { StringItem item = new StringItem("test"); State state = new StringType("foobar"); item.setState(state); assertEquals(state, item.getState()); }
@Test public void setDateTimeTypeType() { StringItem item = new StringItem("test"); State state = new DateTimeType(); item.setState(state); assertEquals(state, item.getState()); }