Search in sources :

Example 16 with OAuthAdminServiceImpl

use of org.wso2.carbon.identity.oauth.OAuthAdminServiceImpl in project identity-inbound-auth-oauth by wso2-extensions.

the class OAuthAdminServiceImplTest method testValidateAudiencesWithInvalidAudiences.

@Test(description = "Test validating invalid audiences", dataProvider = "invalidAudienceDataProvider")
public void testValidateAudiencesWithInvalidAudiences(String[] invalidAudience) {
    OAuthConsumerAppDTO appDTO = new OAuthConsumerAppDTO();
    appDTO.setAudiences(invalidAudience);
    OAuthAdminServiceImpl oAuthAdminService = new OAuthAdminServiceImpl();
    try {
        invokeMethod(oAuthAdminService, "validateAudiences", appDTO);
    } catch (Exception ex) {
        Assert.assertTrue(ex instanceof IdentityOAuthClientException);
        Assert.assertEquals(((IdentityOAuthClientException) ex).getErrorCode(), Error.INVALID_REQUEST.getErrorCode());
    }
}
Also used : OAuthConsumerAppDTO(org.wso2.carbon.identity.oauth.dto.OAuthConsumerAppDTO) InvalidOAuthClientException(org.wso2.carbon.identity.oauth.common.exception.InvalidOAuthClientException) IdentityOAuth2Exception(org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) PowerMockIdentityBaseTest(org.wso2.carbon.identity.testutil.powermock.PowerMockIdentityBaseTest)

Aggregations

PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)13 Test (org.testng.annotations.Test)13 PowerMockIdentityBaseTest (org.wso2.carbon.identity.testutil.powermock.PowerMockIdentityBaseTest)13 OAuthConsumerAppDTO (org.wso2.carbon.identity.oauth.dto.OAuthConsumerAppDTO)10 OAuthAppDO (org.wso2.carbon.identity.oauth.dao.OAuthAppDO)9 Matchers.anyString (org.mockito.Matchers.anyString)7 AuthenticatedUser (org.wso2.carbon.identity.application.authentication.framework.model.AuthenticatedUser)5 OAuthAdminServiceImpl (org.wso2.carbon.identity.oauth.OAuthAdminServiceImpl)3 InvalidOAuthClientException (org.wso2.carbon.identity.oauth.common.exception.InvalidOAuthClientException)2 OAuthAppDAO (org.wso2.carbon.identity.oauth.dao.OAuthAppDAO)2 OAuthAppRevocationRequestDTO (org.wso2.carbon.identity.oauth.dto.OAuthAppRevocationRequestDTO)2 OAuthRevocationResponseDTO (org.wso2.carbon.identity.oauth.dto.OAuthRevocationResponseDTO)2 IdentityOAuth2Exception (org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1 Properties (java.util.Properties)1 GrantType (org.wso2.carbon.identity.api.server.application.management.v1.GrantType)1 GrantTypeMetaData (org.wso2.carbon.identity.api.server.application.management.v1.GrantTypeMetaData)1 MetadataProperty (org.wso2.carbon.identity.api.server.application.management.v1.MetadataProperty)1