### Question:
CMSState { public synchronized void setState(final State to) { CheckConditions.checkNotNull(to); if (to == state) { return; } if (stateMap.get(state).contains(to)) { final State oldState = state; state = to; logger.info("state changed from {} to {}", oldState, to); for (final IEventListener e : listeners) { executor.execute(new EventNotifier(e, oldState, to)); } if (to == State.shutdown) { executor.shutdown(); } } else { logger.error("Can not switch state from " + state + " to " + to); throw new SystemManagementException("Can not switch state from " + state + " to " + to); } } CMSState(); void registerEvent(IEventListener listener); boolean removeEvent(IEventListener listener); synchronized State getState(); synchronized boolean checkAndSetState(final State from, final State to); synchronized void setState(final State to);  }### Answer:
@Test (expected = SystemManagementException.class) public void testChangeStateExceptions_1() { CMSState state = new CMSState(); state.setState(CMSState.State.normal); state.setState(CMSState.State.startup); }
@Test (expected = SystemManagementException.class) public void testChangeStateExceptions_2() { CMSState state = new CMSState(); state.setState(CMSState.State.shutdown); }
@Test (expected = SystemManagementException.class) public void testChangeStateExceptions_3() { CMSState state = new CMSState(); state.setState(CMSState.State.overload); }
@Test (expected = SystemManagementException.class) public void testChangeStateExceptions_4() { CMSState state = new CMSState(); state.setState(CMSState.State.maintain); state.setState(CMSState.State.overload); }
@Test (expected = SystemManagementException.class) public void testChangeStateExceptions_5() { CMSState state = new CMSState(); state.setState(CMSState.State.shutdown); state.setState(CMSState.State.normal); }
@Test (expected = SystemManagementException.class) public void testChangeStateExceptions_6() { CMSState state = new CMSState(); state.setState(CMSState.State.maintain); state.setState(CMSState.State.critical); }
@Test(expected = SystemManagementException.class) public void testChangeStateException_8() { CMSState state = new CMSState(); state.setState(State.normal); state.setState(State.severe); state.setState(CMSState.State.startup); }
@Test public void testChangeStateException_9() { CMSState state = new CMSState(); state.setState(State.normal); state.setState(State.severe); state.setState(CMSState.State.shutdown); }
@Test public void testChangeStateException_10() { CMSState state = new CMSState(); state.setState(State.normal); state.setState(State.severe); state.setState(CMSState.State.maintain); }
@Test(expected = SystemManagementException.class) public void testChangeStateException_11() { CMSState state = new CMSState(); state.setState(State.normal); state.setState(State.readonly); state.setState(CMSState.State.startup); }
@Test public void testChangeStateException_12() { CMSState state = new CMSState(); state.setState(State.normal); state.setState(State.readonly); state.setState(CMSState.State.shutdown); }
@Test public void testChangeStateException_13() { CMSState state = new CMSState(); state.setState(State.normal); state.setState(State.readonly); state.setState(CMSState.State.maintain); }