### Question:
RevokeTokenRequest { protected void checkMandatoryParams() throws OAuthException { if (accessToken == null || accessToken.isEmpty()) { throw new OAuthException(String.format(Response.MANDATORY_PARAM_MISSING, ACCESS_TOKEN), HttpResponseStatus.BAD_REQUEST); } } RevokeTokenRequest(HttpRequest request); String getAccessToken(); void setAccessToken(String accessToken); String getClientId(); void setClientId(String clientId);  }### Answer:
@Test public void when_accessToken_null_return_bad_request() throws Exception { HttpRequest req = mock(HttpRequest.class); String content = "{\"client_id\":\"203598599234220\"," + "\"client_secret\":\"bb635eb22c5b5ce3de06e31bb88be7ae\"}"; ChannelBuffer buf = ChannelBuffers.copiedBuffer(content.getBytes(CharsetUtil.UTF_8)); willReturn(buf).given(req).getContent(); RevokeTokenRequest revokeTokenReq = new RevokeTokenRequest(req); String errorMsg = null; HttpResponseStatus status = null; try { revokeTokenReq.checkMandatoryParams(); } catch (OAuthException e){ errorMsg = e.getMessage(); status = e.getHttpStatus(); } assertEquals(errorMsg, String.format(Response.MANDATORY_PARAM_MISSING, RevokeTokenRequest.ACCESS_TOKEN)); assertEquals(status, HttpResponseStatus.BAD_REQUEST); }
@Test public void when_accessToken_empty_return_bad_request() throws Exception { HttpRequest req = mock(HttpRequest.class); String content = "{\"access_token\":\"\"," + "\"client_id\":\"203598599234220\",\"client_secret\":\"bb635eb22c5b5ce3de06e31bb88be7ae\"}"; ChannelBuffer buf = ChannelBuffers.copiedBuffer(content.getBytes(CharsetUtil.UTF_8)); willReturn(buf).given(req).getContent(); RevokeTokenRequest revokeTokenReq = new RevokeTokenRequest(req); String errorMsg = null; HttpResponseStatus status = null; try { revokeTokenReq.checkMandatoryParams(); } catch (OAuthException e){ errorMsg = e.getMessage(); status = e.getHttpStatus(); } assertEquals(errorMsg, String.format(Response.MANDATORY_PARAM_MISSING, RevokeTokenRequest.ACCESS_TOKEN)); assertEquals(status, HttpResponseStatus.BAD_REQUEST); }