public void setUp() { clockStub.setNow(System.currentTimeMillis()); SimpleStateFactory simpleStateFactory = new SimpleStateFactory(); simpleStateFactory.setClock(clockStub); simpleStateFactory.setTimeoutInMillisecs(TEST_TIMEOUT_IN_MILLISECONDS); simpleStateFactory.setFailureThreshold(FAILURE_THRESHOLD); underTest = new SimpleCircuitBreaker(); underTest.setStateFactory(simpleStateFactory); underTest.initialise(); mockCommand = mock(Command.class); command = (Command) mockCommand.proxy(); }
private void setTimeoutPassed() { long now = clockStub.getNow(); now += TEST_TIMEOUT_IN_MILLISECONDS + 1; clockStub.setNow(now); }