ServiceState { public void becomingPassive() { LOG.warn("Instance becoming passive from {}", state); setState(ServiceStateValue.BECOMING_PASSIVE); } ServiceState();  ServiceState(Configuration configuration); ServiceStateValue getState(); void becomingActive(); void setActive(); void becomingPassive(); void setPassive(); boolean isInstanceInTransition();  }
@Test(expectedExceptions = IllegalStateException.class) public void testShouldDisallowTransitionIfHAIsDisabled() { when(configuration.getBoolean(HAConfiguration.ATLAS_SERVER_HA_ENABLED_KEY, false)).thenReturn(false); ServiceState serviceState = new ServiceState(configuration); serviceState.becomingPassive(); fail("Should not allow transition"); }