ContactItem extends GenericItem { @Override public void setState(State state) { if (isAcceptedState(acceptedDataTypes, state)) { super.setState(state); } else { logSetTypeError(state); } } ContactItem(String name); @Override List<Class<? extends State>> getAcceptedDataTypes(); @Override List<Class<? extends Command>> getAcceptedCommandTypes(); @Override void setState(State state);  }
@Test public void testOpenCloseType() { ContactItem item = new ContactItem("test"); item.setState(OpenClosedType.OPEN); assertEquals(OpenClosedType.OPEN, item.getState()); item.setState(OpenClosedType.CLOSED); assertEquals(OpenClosedType.CLOSED, item.getState()); }