* Test attempting to get an access token using a bad client secret with a
* confidential client.
*/
@Test
public void testGetAccessTokenBadConfidentialClientParams() throws Exception {
FakeHttpServletRequest req = new FakeHttpServletRequest(
"http://localhost:8080/oauth2");
req.setContentType("application/x-www-form-urlencoded");
req.setPostData(
"client_id=" + CONF_CLIENT_ID
+ "&grant_type=authorization_code&redirect_uri="
+ URLEncoder.encode(REDIRECT_URI, "UTF-8") + "&code="
+ CONF_AUTH_CODE + "&client_secret=BAD_SECRET", "UTF-8");
req.setMethod("GET");
req.setServletPath("/oauth2");
req.setPathInfo("/access_token");
HttpServletResponse resp = mock(HttpServletResponse.class);
resp.setStatus(HttpServletResponse.SC_BAD_REQUEST);
MockServletOutputStream outputStream = new MockServletOutputStream();
EasyMock.expect(resp.getOutputStream()).andReturn(outputStream).anyTimes();
PrintWriter writer = new PrintWriter(outputStream);