@Test void resolveArgument_messageWithNoVisibilityHeader_throwIllegalArgumentException() throws Exception { VisibilityHandlerMethodArgumentResolver visibilityHandlerMethodArgumentResolver; visibilityHandlerMethodArgumentResolver = new VisibilityHandlerMethodArgumentResolver( "Visibility"); Message<String> message = MessageBuilder.withPayload("no content").build(); assertThatThrownBy(() -> visibilityHandlerMethodArgumentResolver .resolveArgument(null, message)) .isInstanceOf(IllegalArgumentException.class) .hasMessageContaining("Visibility"); }
@Override public Object resolveArgument(MethodParameter parameter, Message<?> message) throws Exception { if (!message.getHeaders().containsKey(this.visibilityHeaderName) || message.getHeaders().get(this.visibilityHeaderName) == null) { throw new IllegalArgumentException( "No visibility object found for message header: '" + this.visibilityHeaderName + "'"); } return message.getHeaders().get(this.visibilityHeaderName); }
VisibilityHandlerMethodArgumentResolver implements HandlerMethodArgumentResolver { @Override public Object resolveArgument(MethodParameter parameter, Message<?> message) throws Exception { if (!message.getHeaders().containsKey(this.visibilityHeaderName) || message.getHeaders().get(this.visibilityHeaderName) == null) { throw new IllegalArgumentException( "No visibility object found for message header: '" + this.visibilityHeaderName + "'"); } return message.getHeaders().get(this.visibilityHeaderName); } }
VisibilityHandlerMethodArgumentResolver implements HandlerMethodArgumentResolver { @Override public Object resolveArgument(MethodParameter parameter, Message<?> message) throws Exception { if (!message.getHeaders().containsKey(this.visibilityHeaderName) || message.getHeaders().get(this.visibilityHeaderName) == null) { throw new IllegalArgumentException( "No visibility object found for message header: '" + this.visibilityHeaderName + "'"); } return message.getHeaders().get(this.visibilityHeaderName); } VisibilityHandlerMethodArgumentResolver(String visibilityHeaderName); }
VisibilityHandlerMethodArgumentResolver implements HandlerMethodArgumentResolver { @Override public Object resolveArgument(MethodParameter parameter, Message<?> message) throws Exception { if (!message.getHeaders().containsKey(this.visibilityHeaderName) || message.getHeaders().get(this.visibilityHeaderName) == null) { throw new IllegalArgumentException( "No visibility object found for message header: '" + this.visibilityHeaderName + "'"); } return message.getHeaders().get(this.visibilityHeaderName); } VisibilityHandlerMethodArgumentResolver(String visibilityHeaderName); @Override boolean supportsParameter(MethodParameter parameter); @Override Object resolveArgument(MethodParameter parameter, Message<?> message); }
VisibilityHandlerMethodArgumentResolver implements HandlerMethodArgumentResolver { @Override public Object resolveArgument(MethodParameter parameter, Message<?> message) throws Exception { if (!message.getHeaders().containsKey(this.visibilityHeaderName) || message.getHeaders().get(this.visibilityHeaderName) == null) { throw new IllegalArgumentException( "No visibility object found for message header: '" + this.visibilityHeaderName + "'"); } return message.getHeaders().get(this.visibilityHeaderName); } VisibilityHandlerMethodArgumentResolver(String visibilityHeaderName); @Override boolean supportsParameter(MethodParameter parameter); @Override Object resolveArgument(MethodParameter parameter, Message<?> message);  }