use of org.forgerock.openam.entitlement.rest.EntitlementsExceptionMappingHandler in project OpenAM by OpenRock.
the class EntitlementsExceptionMappingHandlerTest method shouldGetExceptionMessageAsFrench.
@Test
public void shouldGetExceptionMessageAsFrench() throws Exception {
// Given
EntitlementsExceptionMappingHandler errorHandler = new EntitlementsExceptionMappingHandler(Collections.singletonMap(EntitlementException.SUBJECT_REQUIRED, ResourceException.BAD_REQUEST));
EntitlementException error = new EntitlementException(EntitlementException.SUBJECT_REQUIRED);
// When
ResourceException result = errorHandler.handleError(getHttpServerContext("fr"), null, error);
// Then
assertThat(result.getMessage()).isEqualTo("Les objets sont obligatoires.");
}
use of org.forgerock.openam.entitlement.rest.EntitlementsExceptionMappingHandler in project OpenAM by OpenRock.
the class EntitlementsExceptionMappingHandlerTest method shouldMapUnknownErrorsAsServerErrors.
@Test
public void shouldMapUnknownErrorsAsServerErrors() {
// Given
EntitlementsExceptionMappingHandler errorHandler = new EntitlementsExceptionMappingHandler(Collections.<Integer, Integer>emptyMap());
EntitlementException error = exception(ERROR_CODE, ERROR_MESSAGE);
// When
ResourceException result = errorHandler.handleError(error);
// Then
assertThat(result).isInstanceOf(InternalServerErrorException.class).hasMessage(ERROR_MESSAGE);
}
Aggregations