@Test public void shouldRethrowServiceNotAvailableExceptionsWithoutWrapping() { RuntimeException response = allocationFailures.responseTo(SERVICE_NOT_AVAILABLE_EXCEPTION); assertThat(response instanceof ServiceNotAvailableException, is(true)); assertThat(response, is(SERVICE_NOT_AVAILABLE_EXCEPTION)); }
public RuntimeException responseTo(Throwable newFailure) { synchronized (this) { logNewFailure(newFailure); previousAllocationFailure = newFailure; } if (newFailure instanceof MultipleRunningTimestampServiceError) { encounteredMultipleRunningTimestamps = true; return wrapMultipleRunningTimestampServiceError(newFailure); } if (newFailure instanceof ServiceNotAvailableException) { return (ServiceNotAvailableException) newFailure; } return new SafeRuntimeException("Could not allocate more timestamps", newFailure); }
TimestampAllocationFailures { public RuntimeException responseTo(Throwable newFailure) { synchronized (this) { logNewFailure(newFailure); previousAllocationFailure = newFailure; } if (newFailure instanceof MultipleRunningTimestampServiceError) { encounteredMultipleRunningTimestamps = true; return wrapMultipleRunningTimestampServiceError(newFailure); } if (newFailure instanceof ServiceNotAvailableException) { return (ServiceNotAvailableException) newFailure; } return new SafeRuntimeException("Could not allocate more timestamps", newFailure); } }
TimestampAllocationFailures { public RuntimeException responseTo(Throwable newFailure) { synchronized (this) { logNewFailure(newFailure); previousAllocationFailure = newFailure; } if (newFailure instanceof MultipleRunningTimestampServiceError) { encounteredMultipleRunningTimestamps = true; return wrapMultipleRunningTimestampServiceError(newFailure); } if (newFailure instanceof ServiceNotAvailableException) { return (ServiceNotAvailableException) newFailure; } return new SafeRuntimeException("Could not allocate more timestamps", newFailure); } @VisibleForTesting  TimestampAllocationFailures(Logger log);  TimestampAllocationFailures(); }
TimestampAllocationFailures { public RuntimeException responseTo(Throwable newFailure) { synchronized (this) { logNewFailure(newFailure); previousAllocationFailure = newFailure; } if (newFailure instanceof MultipleRunningTimestampServiceError) { encounteredMultipleRunningTimestamps = true; return wrapMultipleRunningTimestampServiceError(newFailure); } if (newFailure instanceof ServiceNotAvailableException) { return (ServiceNotAvailableException) newFailure; } return new SafeRuntimeException("Could not allocate more timestamps", newFailure); } @VisibleForTesting  TimestampAllocationFailures(Logger log);  TimestampAllocationFailures(); RuntimeException responseTo(Throwable newFailure); void verifyWeShouldIssueMoreTimestamps(); }
TimestampAllocationFailures { public RuntimeException responseTo(Throwable newFailure) { synchronized (this) { logNewFailure(newFailure); previousAllocationFailure = newFailure; } if (newFailure instanceof MultipleRunningTimestampServiceError) { encounteredMultipleRunningTimestamps = true; return wrapMultipleRunningTimestampServiceError(newFailure); } if (newFailure instanceof ServiceNotAvailableException) { return (ServiceNotAvailableException) newFailure; } return new SafeRuntimeException("Could not allocate more timestamps", newFailure); } @VisibleForTesting  TimestampAllocationFailures(Logger log);  TimestampAllocationFailures(); RuntimeException responseTo(Throwable newFailure); void verifyWeShouldIssueMoreTimestamps();  }