CircuitBreaker { public void openCircuit() { this.lock.lock(); try { if (this.status != Status.OPEN) { LOGGER.warn("OPEN circuit, which is currently {}", this.status); this.countDown = 0; if (this.status == Status.HALF_OPEN) { this.currentDuration = Math.min(this.currentDuration * this.multiplier, this.maximumDuration); } LOGGER.info("Period during which the circuit breaker will be open in milliseconds: {}", this.currentDuration); this.status = Status.OPEN; this.closeCircuitInstant = Instant.now().plusMillis(this.currentDuration); } } finally { this.lock.unlock(); } } private  CircuitBreaker(final Builder builder); void openCircuit(); void closeCircuit(); boolean isClosed(); void markSuccess(); void markFailure();  }
@Test public void testOpenCircuit() { LOGGER.info("Test: expect status is OPEN after an explicit open"); this.circuitBreaker.openCircuit(); assertThat(this.circuitBreaker.isClosed()).withFailMessage("Should be OPEN after explicit open circuit request") .isFalse(); }