diff --git a/spring-integration-file/src/test/java/org/springframework/integration/file/recursive/FileInboundChannelAdapterWithRecursiveDirectoryTests.java b/spring-integration-file/src/test/java/org/springframework/integration/file/recursive/FileInboundChannelAdapterWithRecursiveDirectoryTests.java index 247c189654..2673fbaf8b 100644 --- a/spring-integration-file/src/test/java/org/springframework/integration/file/recursive/FileInboundChannelAdapterWithRecursiveDirectoryTests.java +++ b/spring-integration-file/src/test/java/org/springframework/integration/file/recursive/FileInboundChannelAdapterWithRecursiveDirectoryTests.java @@ -70,7 +70,7 @@ public class FileInboundChannelAdapterWithRecursiveDirectoryTests { File childFile = new File(folder, "baz"); assertTrue(childFile.createNewFile()); - List> received = Arrays.asList(files.receive(), files.receive()); + List received = Arrays.asList((Message) files.receive(), files.receive()); //verify assertThat(received, hasItems(hasPayload(siblingFile), hasPayload(childFile))); } diff --git a/spring-integration-test/src/main/java/org/springframework/integration/test/matcher/PayloadMatcher.java b/spring-integration-test/src/main/java/org/springframework/integration/test/matcher/PayloadMatcher.java index 4a19ffccc8..d385a4da00 100644 --- a/spring-integration-test/src/main/java/org/springframework/integration/test/matcher/PayloadMatcher.java +++ b/spring-integration-test/src/main/java/org/springframework/integration/test/matcher/PayloadMatcher.java @@ -53,14 +53,14 @@ import org.springframework.integration.Message; * @author Iwein Fuld * */ -public class PayloadMatcher extends TypeSafeMatcher> { +public class PayloadMatcher extends TypeSafeMatcher { - private final Matcher matcher; + private final Matcher matcher; /** - * @param matcher + * Create a PayloadMatcher that matches the payload of messages against the given matcher */ - PayloadMatcher(Matcher matcher) { + PayloadMatcher(Matcher matcher) { super(); this.matcher = matcher; } @@ -69,7 +69,7 @@ public class PayloadMatcher extends TypeSafeMatcher> { * {@inheritDoc} */ @Override - public boolean matchesSafely(Message message) { + public boolean matchesSafely(Message message) { return matcher.matches(message.getPayload()); } @@ -83,12 +83,12 @@ public class PayloadMatcher extends TypeSafeMatcher> { } @Factory - public static Matcher> hasPayload(T payload) { + public static Matcher hasPayload(T payload) { return new PayloadMatcher(IsEqual.equalTo(payload)); } @Factory - public static Matcher> hasPayload(Matcher payloadMatcher) { + public static Matcher hasPayload(Matcher payloadMatcher) { return new PayloadMatcher(payloadMatcher); } } \ No newline at end of file diff --git a/spring-integration-test/src/test/java/org/springframework/integration/test/matcher/PayloadMatcherTests.java b/spring-integration-test/src/test/java/org/springframework/integration/test/matcher/PayloadMatcherTests.java index 3b5181fb53..05c2e5503c 100644 --- a/spring-integration-test/src/test/java/org/springframework/integration/test/matcher/PayloadMatcherTests.java +++ b/spring-integration-test/src/test/java/org/springframework/integration/test/matcher/PayloadMatcherTests.java @@ -36,7 +36,7 @@ public class PayloadMatcherTests { static final BigDecimal ANY_PAYLOAD = new BigDecimal("1.123"); - Message message =MessageBuilder.withPayload(ANY_PAYLOAD).build();; + Message message = MessageBuilder.withPayload(ANY_PAYLOAD).build(); @Test public void hasPayload_withEqualValue_matches() throws Exception { @@ -69,4 +69,11 @@ public class PayloadMatcherTests { assertTrue(ae.getMessage().contains("Expected: a Message with payload: ")); } } + + @Test + public void shouldMatchNonParametrizedMessage() throws Exception { + Message message = this.message; + assertThat(message, hasPayload(new BigDecimal("1.123"))); + } + }