Search in sources :

Example 1 with IdServicesException

use of com.sun.identity.idsvcs.IdServicesException in project OpenAM by OpenRock.

the class IdentityServicesExceptionMappingHandlerTest method knownErrorReturns.

@Test
public void knownErrorReturns() {
    //given
    IdRepoException mockException = mock(IdRepoException.class);
    given(mockException.getErrorCode()).willReturn(String.valueOf(IdentityServicesException.GENERAL_OBJECT_NOT_FOUND));
    //when
    IdServicesException exp = handler.handleError(mockException);
    //then
    assertTrue(exp instanceof ObjectNotFound);
}
Also used : ObjectNotFound(com.sun.identity.idsvcs.ObjectNotFound) IdRepoException(com.sun.identity.idm.IdRepoException) IdServicesException(com.sun.identity.idsvcs.IdServicesException) Test(org.testng.annotations.Test)

Example 2 with IdServicesException

use of com.sun.identity.idsvcs.IdServicesException in project OpenAM by OpenRock.

the class IdentityServicesExceptionMappingHandlerTest method knownLdapErrorReturns.

@Test
public void knownLdapErrorReturns() {
    //given
    IdRepoException mockException = mock(IdRepoException.class);
    given(mockException.getLDAPErrorCode()).willReturn(String.valueOf(IdentityServicesException.LDAP_NO_SUCH_OBJECT));
    //when
    IdServicesException exp = handler.handleError(mockException);
    //then
    assertTrue(exp instanceof ObjectNotFound);
}
Also used : ObjectNotFound(com.sun.identity.idsvcs.ObjectNotFound) IdRepoException(com.sun.identity.idm.IdRepoException) IdServicesException(com.sun.identity.idsvcs.IdServicesException) Test(org.testng.annotations.Test)

Example 3 with IdServicesException

use of com.sun.identity.idsvcs.IdServicesException in project OpenAM by OpenRock.

the class IdentityServicesExceptionMappingHandlerTest method unknownErrorReturnsGeneralFailureWithMessage.

@Test
public void unknownErrorReturnsGeneralFailureWithMessage() {
    //given
    IdRepoException mockException = mock(IdRepoException.class);
    given(mockException.getErrorCode()).willReturn("-1");
    given(mockException.getMessage()).willReturn("Message");
    //when
    IdServicesException exp = handler.handleError(mockException);
    //then
    assertTrue(exp instanceof GeneralFailure);
    assertTrue(exp.getMessage().equals("Message"));
}
Also used : IdRepoException(com.sun.identity.idm.IdRepoException) GeneralFailure(com.sun.identity.idsvcs.GeneralFailure) IdServicesException(com.sun.identity.idsvcs.IdServicesException) Test(org.testng.annotations.Test)

Aggregations

IdRepoException (com.sun.identity.idm.IdRepoException)3 IdServicesException (com.sun.identity.idsvcs.IdServicesException)3 Test (org.testng.annotations.Test)3 ObjectNotFound (com.sun.identity.idsvcs.ObjectNotFound)2 GeneralFailure (com.sun.identity.idsvcs.GeneralFailure)1