### Question:
NonceTooLowRetryMechanism extends RetryMechanism { @Override public boolean responseRequiresRetry(final int httpStatusCode, final String body) { if ((httpStatusCode == HttpResponseStatus.BAD_REQUEST.code())) { final JsonRpcErrorResponse errorResponse = specialiseResponse(body); if (NONCE_TOO_LOW.equals(errorResponse.getError())) { LOG.info("Nonce too low, resend required for {}.", errorResponse.getId()); return true; } } return false; } NonceTooLowRetryMechanism(final int maxRetries); @Override boolean responseRequiresRetry(final int httpStatusCode, final String body);  }### Answer:
@Test public void retryIsNotRequiredIfErrorIsNotNonceTooLow() { when(httpResponse.statusCode()).thenReturn(HttpResponseStatus.BAD_REQUEST.code()); final JsonRpcErrorResponse errorResponse = new JsonRpcErrorResponse(JsonRpcError.INVALID_PARAMS); assertThat( retryMechanism.responseRequiresRetry( httpResponse.statusCode(), Json.encode(errorResponse))) .isFalse(); }
@Test public void retryIsNotRequiredForUnknownErrorType() { when(httpResponse.statusCode()).thenReturn(HttpResponseStatus.BAD_REQUEST.code()); final JsonObject errorResponse = new JsonObject(); final JsonObject error = new JsonObject(); error.put("code", -9000); error.put("message", "Unknown error"); errorResponse.put("jsonrpc", "2.0"); errorResponse.put("id", 1); errorResponse.put("error", new JsonObject()); assertThat( retryMechanism.responseRequiresRetry( httpResponse.statusCode(), Json.encode(errorResponse))) .isFalse(); }