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