@Test public void shouldValidateCallbackTypeSuccessfully() throws JSONException { String callbackName = "CALLBACK_NAME"; JsonValue jsonCallback = mock(JsonValue.class); JsonValue typeJson = mock(JsonValue.class); given(jsonCallback.get("type")).willReturn(typeJson); given(typeJson.asString()).willReturn("CALLBACK_NAME"); abstractRestAuthCallbackHandler.validateCallbackType(callbackName, jsonCallback); }
final void validateCallbackType(String callbackName, JsonValue jsonCallback) { String type = jsonCallback.get("type").asString(); if (!callbackName.equalsIgnoreCase(type)) { DEBUG.message(MessageFormat.format("Method called with invalid callback, {0}.", type)); throw new RestAuthException(Response.Status.BAD_REQUEST, MessageFormat.format("Invalid Callback, {0}, for handler", type)); } }
AbstractRestAuthCallbackHandler implements RestAuthCallbackHandler<T> { final void validateCallbackType(String callbackName, JsonValue jsonCallback) { String type = jsonCallback.get("type").asString(); if (!callbackName.equalsIgnoreCase(type)) { DEBUG.message(MessageFormat.format("Method called with invalid callback, {0}.", type)); throw new RestAuthException(Response.Status.BAD_REQUEST, MessageFormat.format("Invalid Callback, {0}, for handler", type)); } } }
AbstractRestAuthCallbackHandler implements RestAuthCallbackHandler<T> { final void validateCallbackType(String callbackName, JsonValue jsonCallback) { String type = jsonCallback.get("type").asString(); if (!callbackName.equalsIgnoreCase(type)) { DEBUG.message(MessageFormat.format("Method called with invalid callback, {0}.", type)); throw new RestAuthException(Response.Status.BAD_REQUEST, MessageFormat.format("Invalid Callback, {0}, for handler", type)); } }  }
AbstractRestAuthCallbackHandler implements RestAuthCallbackHandler<T> { final void validateCallbackType(String callbackName, JsonValue jsonCallback) { String type = jsonCallback.get("type").asString(); if (!callbackName.equalsIgnoreCase(type)) { DEBUG.message(MessageFormat.format("Method called with invalid callback, {0}.", type)); throw new RestAuthException(Response.Status.BAD_REQUEST, MessageFormat.format("Invalid Callback, {0}, for handler", type)); } }  boolean updateCallbackFromRequest(HttpHeaders headers, HttpServletRequest request,
            HttpServletResponse response, T callback); }
AbstractRestAuthCallbackHandler implements RestAuthCallbackHandler<T> { final void validateCallbackType(String callbackName, JsonValue jsonCallback) { String type = jsonCallback.get("type").asString(); if (!callbackName.equalsIgnoreCase(type)) { DEBUG.message(MessageFormat.format("Method called with invalid callback, {0}.", type)); throw new RestAuthException(Response.Status.BAD_REQUEST, MessageFormat.format("Invalid Callback, {0}, for handler", type)); } }  boolean updateCallbackFromRequest(HttpHeaders headers, HttpServletRequest request,
            HttpServletResponse response, T callback);  }