Fix ResourceBannerTests failures on Windows

Fixes gh-2096
This commit is contained in:
Phillip Webb 2014-12-09 10:02:40 -08:00
parent a69afa0dca
commit f1cf66163e
1 changed files with 5 additions and 5 deletions

View File

@ -28,7 +28,7 @@ import org.springframework.core.io.ByteArrayResource;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.springframework.mock.env.MockEnvironment; import org.springframework.mock.env.MockEnvironment;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.startsWith;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
/** /**
@ -43,7 +43,7 @@ public class ResourceBannerTests {
Resource resource = new ByteArrayResource( Resource resource = new ByteArrayResource(
"banner ${a} ${spring-boot.version} ${application.version}".getBytes()); "banner ${a} ${spring-boot.version} ${application.version}".getBytes());
String banner = printBanner(resource, "10.2", "2.0"); String banner = printBanner(resource, "10.2", "2.0");
assertThat(banner, equalTo("banner 1 10.2 2.0\n")); assertThat(banner, startsWith("banner 1 10.2 2.0\n"));
} }
@Test @Test
@ -51,7 +51,7 @@ public class ResourceBannerTests {
Resource resource = new ByteArrayResource( Resource resource = new ByteArrayResource(
"banner ${a} ${spring-boot.version} ${application.version}".getBytes()); "banner ${a} ${spring-boot.version} ${application.version}".getBytes());
String banner = printBanner(resource, null, null); String banner = printBanner(resource, null, null);
assertThat(banner, equalTo("banner 1 \n")); assertThat(banner, startsWith("banner 1 \n"));
} }
@Test @Test
@ -60,7 +60,7 @@ public class ResourceBannerTests {
"banner ${a}${spring-boot.formatted-version}${application.formatted-version}" "banner ${a}${spring-boot.formatted-version}${application.formatted-version}"
.getBytes()); .getBytes());
String banner = printBanner(resource, "10.2", "2.0"); String banner = printBanner(resource, "10.2", "2.0");
assertThat(banner, equalTo("banner 1 (v10.2) (v2.0)\n")); assertThat(banner, startsWith("banner 1 (v10.2) (v2.0)\n"));
} }
@Test @Test
@ -69,7 +69,7 @@ public class ResourceBannerTests {
"banner ${a}${spring-boot.formatted-version}${application.formatted-version}" "banner ${a}${spring-boot.formatted-version}${application.formatted-version}"
.getBytes()); .getBytes());
String banner = printBanner(resource, null, null); String banner = printBanner(resource, null, null);
assertThat(banner, equalTo("banner 1\n")); assertThat(banner, startsWith("banner 1\n"));
} }
private String printBanner(Resource resource, String bootVersion, private String printBanner(Resource resource, String bootVersion,