Search in sources :

Example 1 with SimbaMessageKey

use of org.simbasecurity.core.exception.SimbaMessageKey in project simba-os by cegeka.

the class TSimbaErrorMappingHandlerTest method handle_canConvertAllSimbaMessageKeys.

@Test
public void handle_canConvertAllSimbaMessageKeys() {
    List<SimbaMessageKey> ignoredSimbaMessageKeys = asList(EMPTY_USERNAME, EMPTY_PASSWORD, WRONG_PASSWORD, EMPTY_TARGET_URL, LOGIN_FAILED, ACCESS_DENIED, EMPTY_SUCCESS_URL, ACCOUNT_BLOCKED, MAIL_ERROR);
    Arrays.stream(values()).filter(messageKey -> !ignoredSimbaMessageKeys.contains(messageKey)).forEach(messageKey -> {
        assertThatThrownBy(() -> handler.handle(new SimbaException(messageKey, messageKey.name()))).isInstanceOf(TSimbaError.class);
    });
}
Also used : Arrays(java.util.Arrays) List(java.util.List) Assertions.assertThatThrownBy(org.assertj.core.api.Assertions.assertThatThrownBy) Arrays.asList(java.util.Arrays.asList) Test(org.junit.Test) TSimbaError(org.simbasecurity.api.service.thrift.TSimbaError) Before(org.junit.Before) SimbaException(org.simbasecurity.core.exception.SimbaException) SimbaMessageKey(org.simbasecurity.core.exception.SimbaMessageKey) SimbaException(org.simbasecurity.core.exception.SimbaException) SimbaMessageKey(org.simbasecurity.core.exception.SimbaMessageKey) Test(org.junit.Test)

Aggregations

Arrays (java.util.Arrays)1 Arrays.asList (java.util.Arrays.asList)1 List (java.util.List)1 Assertions.assertThatThrownBy (org.assertj.core.api.Assertions.assertThatThrownBy)1 Before (org.junit.Before)1 Test (org.junit.Test)1 TSimbaError (org.simbasecurity.api.service.thrift.TSimbaError)1 SimbaException (org.simbasecurity.core.exception.SimbaException)1 SimbaMessageKey (org.simbasecurity.core.exception.SimbaMessageKey)1