@Test public void testRestart() throws Exception { MockConnection component = new MockConnection(); component.requestInit(); InitialisedState state = InitialisedState.getInstance(); state.requestRestart(component); assertEquals(StartedState.getInstance(), component.retrieveComponentState()); assertEquals(2, component.getInitCount()); assertEquals(1, component.getStartCount()); assertEquals(0, component.getStopCount()); assertEquals(1, component.getCloseCount()); }
public static InitialisedState getInstance() { if (instance == null) { instance = new InitialisedState(); } return instance; }
InitialisedState extends ComponentStateImp { public static InitialisedState getInstance() { if (instance == null) { instance = new InitialisedState(); } return instance; } }
InitialisedState extends ComponentStateImp { public static InitialisedState getInstance() { if (instance == null) { instance = new InitialisedState(); } return instance; } private  InitialisedState(); }
InitialisedState extends ComponentStateImp { public static InitialisedState getInstance() { if (instance == null) { instance = new InitialisedState(); } return instance; } private  InitialisedState(); @Override void requestStart(StateManagedComponent comp); @Override void requestClose(StateManagedComponent comp); static InitialisedState getInstance(); }
InitialisedState extends ComponentStateImp { public static InitialisedState getInstance() { if (instance == null) { instance = new InitialisedState(); } return instance; } private  InitialisedState(); @Override void requestStart(StateManagedComponent comp); @Override void requestClose(StateManagedComponent comp); static InitialisedState getInstance();  }