### Question:
AbstractRestAuthCallbackHandler implements RestAuthCallbackHandler<T> { final void validateCallbackType(String callbackName, JsonValue jsonCallback) throws RestAuthException { String type = jsonCallback.get("type").asString(); if (!callbackName.equalsIgnoreCase(type)) { DEBUG.message(MessageFormat.format("Method called with invalid callback, {0}.", type)); throw new RestAuthException(ResourceException.BAD_REQUEST, MessageFormat.format("Invalid Callback, {0}, for handler", type)); } }  boolean updateCallbackFromRequest(HttpServletRequest request, HttpServletResponse response, T callback);  }### Answer:
@Test public void shouldValidateCallbackTypeSuccessfully() throws JSONException, RestAuthException { 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); }
@Test (expectedExceptions = RestAuthException.class) public void shouldValidateCallbackTypeUnsuccessfully() throws JSONException, RestAuthException { 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_NOT"); abstractRestAuthCallbackHandler.validateCallbackType(callbackName, jsonCallback); fail(); }