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);
}
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);
}
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"));
}
Aggregations