CircuitBreaker implements MonitoredService, ServiceWrapper { public void tripHard() { this.trip(); isHardTrip = true; } CircuitBreaker();  CircuitBreaker(String name);  CircuitBreaker(FailureInterpreter fi);  CircuitBreaker(String name, FailureInterpreter fi);  CircuitBreaker(String name, CircuitBreakerExceptionMapper<? extends Exception> mapper);  CircuitBreaker(String name,
                          FailureInterpreter fi,
                          CircuitBreakerExceptionMapper<? extends Exception> mapper); Throwable getTripException(); String getTripExceptionAsString(); void setClock(Clock clock); Clock getClock(); V invoke(Callable<V> c); void invoke(Runnable r); V invoke(Runnable r, V result); void setByPassState(boolean b); boolean getByPassState(); void trip(); void tripHard(); long getLastTripTime(); long getTripCount(); void reset(); Status getStatus(); ServiceStatus getServiceStatus(); long getResetMillis(); void setResetMillis(long l); String getHealthCheck(); void setLimit(int limit); void setIgnore(Collection<Class<? extends Throwable>> ignore); void setWindowMillis(long windowMillis); void setFailureInterpreter(FailureInterpreter failureInterpreter); FailureInterpreter getFailureInterpreter(); void setExceptionMapper(CircuitBreakerExceptionMapper<? extends Exception> mapper); void addListener(CircuitBreakerNotificationCallback listener); void setListeners(ArrayList<CircuitBreakerNotificationCallback> listeners); CircuitBreakerExceptionMapper<? extends Exception> getExceptionMapper();  }
@Test public void testTripHard() throws Exception { expect(mockCallable.call()).andReturn("hi"); replay(mockCallable); impl.tripHard(); try { impl.invoke(mockCallable); fail("exception expected after CircuitBreaker.tripHard()"); } catch (CircuitBreakerException e) { } assertEquals(CircuitBreaker.BreakerState.OPEN, impl.state); impl.reset(); impl.invoke(mockCallable); assertEquals(CircuitBreaker.BreakerState.CLOSED, impl.state); verify(mockCallable); }