use of org.springframework.binding.message.DefaultMessageResolver in project head by mifos.
the class MessageMatcher method matchesSafely.
@Override
public boolean matchesSafely(MessageResolver messageResolver) {
DefaultMessageResolver defaultMessageResolver = (DefaultMessageResolver) messageResolver;
String[] codes = defaultMessageResolver.getCodes();
for (String code : codes) {
if (StringUtils.equals(code, errorCode))
return true;
}
return false;
}
use of org.springframework.binding.message.DefaultMessageResolver in project cas by apereo.
the class AuthenticationExceptionHandlerTests method handleUnsatisfiedAuthenticationPolicyExceptionByDefault.
@Test
public void handleUnsatisfiedAuthenticationPolicyExceptionByDefault() {
final AuthenticationExceptionHandler handler = new AuthenticationExceptionHandler();
final MessageContext ctx = mock(MessageContext.class);
final ContextualAuthenticationPolicy<?> policy = new TestContextualAuthenticationPolicy();
final String id = handler.handle(new UnsatisfiedAuthenticationPolicyException(policy), ctx);
assertEquals(id, "UnsatisfiedAuthenticationPolicyException");
final ArgumentCaptor<DefaultMessageResolver> message = ArgumentCaptor.forClass(DefaultMessageResolver.class);
verify(ctx, times(1)).addMessage(message.capture());
assertArrayEquals(new String[] { policy.getCode().get() }, message.getValue().getCodes());
}
Aggregations