From af711a0d30613368f8ed4ace8b030a54e8486e50 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Fri, 24 Feb 2017 12:45:56 -0500 Subject: [PATCH] Fix tests for wrong messages in assertions https://build.spring.io/browse/INT-MASTER-560/ **Cherry-pick to 4.3.x** --- .../config/xml/DelegatingConsumerParserTests.java | 4 ++-- ...erviceActivatorDefaultFrameworkMethodTests.java | 14 ++++---------- ...erviceActivatorDefaultFrameworkMethodTests.java | 7 ++++--- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/DelegatingConsumerParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/DelegatingConsumerParserTests.java index e7ca5c3a79..2a8545e829 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/DelegatingConsumerParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/DelegatingConsumerParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2016 the original author or authors. + * Copyright 2013-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -185,7 +185,7 @@ public class DelegatingConsumerParserTests { fail("expected exception"); } catch (Exception e) { - assertEquals("An AbstractReplyProducingMessageHandler may only be referenced once (foo) - " + assertEquals("An AbstractMessageProducingMessageHandler may only be referenced once (foo) - " + "use scope=\"prototype\"", e.getMessage()); } } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/handler/ServiceActivatorDefaultFrameworkMethodTests.java b/spring-integration-core/src/test/java/org/springframework/integration/handler/ServiceActivatorDefaultFrameworkMethodTests.java index ebd0f8ef38..b286802c46 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/handler/ServiceActivatorDefaultFrameworkMethodTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/handler/ServiceActivatorDefaultFrameworkMethodTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -171,7 +171,7 @@ public class ServiceActivatorDefaultFrameworkMethodTests { this.handlerTestInputChannel.send(message); } -// INT-2399 + // INT-2399 @Test public void testMessageProcessor() { Object processor = TestUtils.getPropertyValue(processorTestService, "handler.processor"); @@ -197,7 +197,7 @@ public class ServiceActivatorDefaultFrameworkMethodTests { assertThat(e.getCause(), Matchers.instanceOf(BeanCreationException.class)); assertThat(e.getCause().getCause(), Matchers.instanceOf(IllegalArgumentException.class)); assertThat(e.getCause().getCause().getMessage(), - Matchers.containsString("An AbstractReplyProducingMessageHandler may only be referenced once")); + Matchers.containsString("An AbstractMessageProducingMessageHandler may only be referenced once")); } } @@ -219,13 +219,7 @@ public class ServiceActivatorDefaultFrameworkMethodTests { public void testAsyncWithDirectReply() { DirectChannel replyChannel = new DirectChannel(); final AtomicReference> reply = new AtomicReference>(); - replyChannel.subscribe(new MessageHandler() { - - @Override - public void handleMessage(Message message) throws MessagingException { - reply.set(message); - } - }); + replyChannel.subscribe(reply::set); Message message = MessageBuilder.withPayload("testing").setReplyChannel(replyChannel).build(); this.asyncIn.send(message); diff --git a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/ServiceActivatorDefaultFrameworkMethodTests.java b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/ServiceActivatorDefaultFrameworkMethodTests.java index 9bdfe4214c..1019f15adf 100644 --- a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/ServiceActivatorDefaultFrameworkMethodTests.java +++ b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/ServiceActivatorDefaultFrameworkMethodTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -147,7 +147,7 @@ public class ServiceActivatorDefaultFrameworkMethodTests { this.handlerTestInputChannel.send(message); } -// INT-2399 + // INT-2399 @Test public void testMessageProcessor() { Object processor = TestUtils.getPropertyValue(processorTestService, "handler.processor"); @@ -173,7 +173,7 @@ public class ServiceActivatorDefaultFrameworkMethodTests { assertThat(e.getCause(), Matchers.instanceOf(BeanCreationException.class)); assertThat(e.getCause().getCause(), Matchers.instanceOf(IllegalArgumentException.class)); assertThat(e.getCause().getCause().getMessage(), - Matchers.containsString("An AbstractReplyProducingMessageHandler may only be referenced once")); + Matchers.containsString("An AbstractMessageProducingMessageHandler may only be referenced once")); } } @@ -230,6 +230,7 @@ public class ServiceActivatorDefaultFrameworkMethodTests { public String processMessage(Message message) { return prefix + ":" + message.getPayload(); } + } }