@Test public void testCodeGrantTypeHandler_1() throws Exception { final CodeGrantTypeHandler result = new CodeGrantTypeHandler(); Assert.assertNotNull(result); Assert.assertTrue(GrantRequestHandler.class.isInstance(result)); Assert.assertEquals("code", result.getGrantType()); Assert.assertEquals("authorization_code", CodeGrantTypeHandler.getResponseType()); Assert.assertEquals(true, result.isAuthorizationEndpointResponse()); Assert.assertEquals(true, result.isRedirectRequired()); Assert.assertEquals(false, result.isTokenEndpointResponse()); }
@Test(expected = OAuth2RequestException.class) public void testGetCompleteUrl_1() throws Exception { final CodeGrantTypeHandler fixture = CodeGrantTypeHandlerTest.cgth; final OAuth2Accessor accessor = null; fixture.getCompleteUrl(accessor); }
@Test public void testGetGrantType_1() throws Exception { final CodeGrantTypeHandler fixture = CodeGrantTypeHandlerTest.cgth; final String result = fixture.getGrantType(); Assert.assertEquals("code", result); }
@Before public void setUp() throws Exception { CodeGrantTypeHandlerTest.cgth = new CodeGrantTypeHandler(); }
@Test public void testIsRedirectRequired_1() throws Exception { final CodeGrantTypeHandler fixture = CodeGrantTypeHandlerTest.cgth; final boolean result = fixture.isRedirectRequired(); Assert.assertEquals(true, result); }
@Test public void testIsTokenEndpointResponse_1() throws Exception { final CodeGrantTypeHandler fixture = CodeGrantTypeHandlerTest.cgth; final boolean result = fixture.isTokenEndpointResponse(); Assert.assertEquals(false, result); } }
@Test public void testIsAuthorizationEndpointResponse_1() throws Exception { final CodeGrantTypeHandler fixture = CodeGrantTypeHandlerTest.cgth; final boolean result = fixture.isAuthorizationEndpointResponse(); Assert.assertEquals(true, result); }
@Test public void testGetResponseType_1() throws Exception { final String result = CodeGrantTypeHandler.getResponseType(); Assert.assertEquals("authorization_code", result); }
@Test(expected = OAuth2RequestException.class) public void testGetAuthorizationRequest_1() throws Exception { final CodeGrantTypeHandler fixture = CodeGrantTypeHandlerTest.cgth; final OAuth2Accessor accessor = MockUtils.getOAuth2Accessor_Code(); final String completeAuthorizationUrl = "xxx"; fixture.getAuthorizationRequest(accessor, completeAuthorizationUrl); }
queryParams.put(OAuth2Message.RESPONSE_TYPE, this.getGrantType()); queryParams.put(OAuth2Message.CLIENT_ID, accessor.getClientId()); final String redirectUri = accessor.getRedirectUri();
@Before public void setUp() throws Exception { CodeGrantTypeHandlerTest.cgth = new CodeGrantTypeHandler(); }
@Test public void testIsRedirectRequired_1() throws Exception { final CodeGrantTypeHandler fixture = CodeGrantTypeHandlerTest.cgth; final boolean result = fixture.isRedirectRequired(); Assert.assertEquals(true, result); }
@Test public void testIsTokenEndpointResponse_1() throws Exception { final CodeGrantTypeHandler fixture = CodeGrantTypeHandlerTest.cgth; final boolean result = fixture.isTokenEndpointResponse(); Assert.assertEquals(false, result); } }
@Test public void testIsAuthorizationEndpointResponse_1() throws Exception { final CodeGrantTypeHandler fixture = CodeGrantTypeHandlerTest.cgth; final boolean result = fixture.isAuthorizationEndpointResponse(); Assert.assertEquals(true, result); }
@Test public void testGetResponseType_1() throws Exception { final String result = CodeGrantTypeHandler.getResponseType(); Assert.assertEquals("authorization_code", result); }
@Test(expected = OAuth2RequestException.class) public void testGetAuthorizationRequest_1() throws Exception { final CodeGrantTypeHandler fixture = CodeGrantTypeHandlerTest.cgth; final OAuth2Accessor accessor = MockUtils.getOAuth2Accessor_Code(); final String completeAuthorizationUrl = "xxx"; fixture.getAuthorizationRequest(accessor, completeAuthorizationUrl); }
@Test public void testCodeGrantTypeHandler_1() throws Exception { final CodeGrantTypeHandler result = new CodeGrantTypeHandler(); Assert.assertNotNull(result); Assert.assertTrue(GrantRequestHandler.class.isInstance(result)); Assert.assertEquals("code", result.getGrantType()); Assert.assertEquals("authorization_code", CodeGrantTypeHandler.getResponseType()); Assert.assertEquals(true, result.isAuthorizationEndpointResponse()); Assert.assertEquals(true, result.isRedirectRequired()); Assert.assertEquals(false, result.isTokenEndpointResponse()); }
@Test(expected = OAuth2RequestException.class) public void testGetCompleteUrl_1() throws Exception { final CodeGrantTypeHandler fixture = CodeGrantTypeHandlerTest.cgth; final OAuth2Accessor accessor = null; fixture.getCompleteUrl(accessor); }
@Test public void testGetGrantType_1() throws Exception { final CodeGrantTypeHandler fixture = CodeGrantTypeHandlerTest.cgth; final String result = fixture.getGrantType(); Assert.assertEquals("code", result); }
@Test @SuppressWarnings({ "unchecked", "unused" }) public void testProvideGrantRequestHandlers_1() throws Exception { final OAuth2HandlerModule fixture = new OAuth2HandlerModule(); final ClientCredentialsGrantTypeHandler clientCredentialsGrantTypeHandler = new ClientCredentialsGrantTypeHandler( EasyMock.createNiceMock(List.class)); final CodeGrantTypeHandler codeGrantTypeHandler = new CodeGrantTypeHandler(); final List<GrantRequestHandler> result = OAuth2HandlerModule.provideGrantRequestHandlers( clientCredentialsGrantTypeHandler, codeGrantTypeHandler); Assert.assertNotNull(result); Assert.assertEquals(2, result.size()); }