### Question:
AbstractValidator implements OAuthValidator<T> { @Override public void validateContentType(T request) throws OAuthProblemException { String contentType = request.getContentType(); final String expectedContentType = OAuth.ContentType.URL_ENCODED; if (!OAuthUtils.hasContentType(contentType, expectedContentType)) { throw OAuthUtils.handleBadContentTypeException(expectedContentType); } }  @Override void validateMethod(T request); @Override void validateContentType(T request); @Override void validateRequiredParameters(T request); @Override void validateOptionalParameters(T request); @Override void validateNotAllowedParameters(T request); @Override void validateClientAuthenticationCredentials(T request); @Override void performAllValidations(T request);  }### Answer:
@Test public void testValidateContentType() throws Exception { HttpServletRequest request = createStrictMock(HttpServletRequest.class); expect(request.getContentType()).andStubReturn(OAuth.ContentType.URL_ENCODED); replay(request); AbstractValidator validator = new AbstractValidatorImpl(); validator.validateContentType(request); verify(request); reset(request); expect(request.getContentType()).andStubReturn(OAuth.ContentType.URL_ENCODED + ";utf-8"); replay(request); validator = new AbstractValidatorImpl(); validator.validateContentType(request); verify(request); }
@Test(expected = OAuthProblemException.class) public void testInvalidContentType() throws Exception { HttpServletRequest request = createStrictMock(HttpServletRequest.class); expect(request.getContentType()).andStubReturn(OAuth.ContentType.JSON); replay(request); AbstractValidator validator = new AbstractValidatorImpl(); validator.validateContentType(request); verify(request); }