From 682d0f524fa53ab6438a61424d45f75380ed77ec Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 17 Jan 2017 13:17:32 +0000 Subject: [PATCH] Test insecure, insensitive endpoint with property that's always available The user property is only available on Unix-like platforms (due to the USER environment variable). This commit updates the test to explicitly set a specific property and then check that it's accessible via the env endpoint rather than using one that is OS-specific. See gh-7868 See gh-7881 --- .../ui/secure/SampleHypermediaUiSecureApplicationTests.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spring-boot-samples/spring-boot-sample-hypermedia-ui-secure/src/test/java/sample/hypermedia/ui/secure/SampleHypermediaUiSecureApplicationTests.java b/spring-boot-samples/spring-boot-sample-hypermedia-ui-secure/src/test/java/sample/hypermedia/ui/secure/SampleHypermediaUiSecureApplicationTests.java index 5a448fa9f3..651f87980f 100644 --- a/spring-boot-samples/spring-boot-sample-hypermedia-ui-secure/src/test/java/sample/hypermedia/ui/secure/SampleHypermediaUiSecureApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-hypermedia-ui-secure/src/test/java/sample/hypermedia/ui/secure/SampleHypermediaUiSecureApplicationTests.java @@ -30,7 +30,7 @@ import static org.assertj.core.api.Assertions.assertThat; @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, properties = { - "endpoints.env.sensitive=false" }) + "endpoints.env.sensitive=false", "foo=bar" }) public class SampleHypermediaUiSecureApplicationTests { @Autowired @@ -47,10 +47,10 @@ public class SampleHypermediaUiSecureApplicationTests { ResponseEntity entity = this.restTemplate.getForEntity("/env", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); - ResponseEntity user = this.restTemplate.getForEntity("/env/user", + ResponseEntity user = this.restTemplate.getForEntity("/env/foo", String.class); assertThat(user.getStatusCode()).isEqualTo(HttpStatus.OK); - assertThat(user.getBody()).contains("{\"user\":"); + assertThat(user.getBody()).contains("{\"foo\":"); } @Test