From 6affb3bb2ffa2b86cb512a7a8408e8c07c3f4846 Mon Sep 17 00:00:00 2001 From: Gary Russell Date: Fri, 29 Jun 2018 14:59:26 -0400 Subject: [PATCH] INT-4495: Fix SFTP tests --- .../sftp/inbound/SftpMessageSourceTests.java | 4 +++- .../sftp/inbound/SftpStreamingMessageSourceTests.java | 10 +++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/inbound/SftpMessageSourceTests.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/inbound/SftpMessageSourceTests.java index eb2142de59..80bc60c808 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/inbound/SftpMessageSourceTests.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/inbound/SftpMessageSourceTests.java @@ -16,6 +16,7 @@ package org.springframework.integration.sftp.inbound; +import static org.hamcrest.Matchers.anyOf; import static org.hamcrest.Matchers.equalTo; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertThat; @@ -49,7 +50,8 @@ public class SftpMessageSourceTests extends SftpTestSupport { SftpInboundFileSynchronizingMessageSource messageSource = buildSource(); Message received = messageSource.receive(); assertNotNull(received); - assertThat(received.getHeaders().get(FileHeaders.FILENAME), equalTo(" sftpSource1.txt")); + assertThat(received.getHeaders().get(FileHeaders.FILENAME), + anyOf(equalTo(" sftpSource1.txt"), equalTo("sftpSource2.txt"))); } private SftpInboundFileSynchronizingMessageSource buildSource() throws Exception { diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/inbound/SftpStreamingMessageSourceTests.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/inbound/SftpStreamingMessageSourceTests.java index 9a238eb5a1..9854a3aa98 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/inbound/SftpStreamingMessageSourceTests.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/inbound/SftpStreamingMessageSourceTests.java @@ -18,6 +18,7 @@ package org.springframework.integration.sftp.inbound; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.Matchers.anyOf; import static org.hamcrest.Matchers.equalTo; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertThat; @@ -124,7 +125,8 @@ public class SftpStreamingMessageSourceTests extends SftpTestSupport { messageSource.afterPropertiesSet(); Message received = messageSource.receive(); assertNotNull(received); - assertThat(received.getHeaders().get(FileHeaders.REMOTE_FILE), equalTo(" sftpSource1.txt")); + assertThat(received.getHeaders().get(FileHeaders.REMOTE_FILE), + anyOf(equalTo(" sftpSource1.txt"), equalTo("sftpSource2.txt"))); } @Test @@ -134,7 +136,8 @@ public class SftpStreamingMessageSourceTests extends SftpTestSupport { messageSource.afterPropertiesSet(); Message received = messageSource.receive(); assertNotNull(received); - assertThat(received.getHeaders().get(FileHeaders.REMOTE_FILE), equalTo(" sftpSource1.txt")); + assertThat(received.getHeaders().get(FileHeaders.REMOTE_FILE), + anyOf(equalTo(" sftpSource1.txt"), equalTo("sftpSource2.txt"))); } @Test @@ -144,7 +147,8 @@ public class SftpStreamingMessageSourceTests extends SftpTestSupport { messageSource.afterPropertiesSet(); Message received = messageSource.receive(); assertNotNull(received); - assertThat(received.getHeaders().get(FileHeaders.REMOTE_FILE), equalTo(" sftpSource1.txt")); + assertThat(received.getHeaders().get(FileHeaders.REMOTE_FILE), + anyOf(equalTo(" sftpSource1.txt"), equalTo("sftpSource2.txt"))); } private SftpStreamingMessageSource buildSource() {