### Question:
IdentityServicesExceptionMappingHandler implements ExceptionMappingHandler<IdRepoException, IdServicesException> { @Override public IdServicesException handleError(Context context, String debug, Request request, IdRepoException error) { return handleError(error); }  @Override IdServicesException handleError(Context context, String debug, Request request, IdRepoException error); @Override IdServicesException handleError(String debug, Request request, IdRepoException error); @Override IdServicesException handleError(Context context, Request request, IdRepoException error); @Override IdServicesException handleError(Request request, IdRepoException error); @Override IdServicesException handleError(IdRepoException error);  }### Answer:
@Test public void unknownErrorReturnsGeneralFailureWithMessage() { IdRepoException mockException = mock(IdRepoException.class); given(mockException.getErrorCode()).willReturn("-1"); given(mockException.getMessage()).willReturn("Message"); IdServicesException exp = handler.handleError(mockException); assertTrue(exp instanceof GeneralFailure); assertTrue(exp.getMessage().equals("Message")); }
@Test public void knownLdapErrorReturns() { IdRepoException mockException = mock(IdRepoException.class); given(mockException.getLDAPErrorCode()).willReturn(String.valueOf(IdentityServicesException.LDAP_NO_SUCH_OBJECT)); IdServicesException exp = handler.handleError(mockException); assertTrue(exp instanceof ObjectNotFound); }
@Test public void knownErrorReturns() { IdRepoException mockException = mock(IdRepoException.class); given(mockException.getErrorCode()).willReturn(String.valueOf(IdentityServicesException.GENERAL_OBJECT_NOT_FOUND)); IdServicesException exp = handler.handleError(mockException); assertTrue(exp instanceof ObjectNotFound); }