From cc70eae896402d889040758824230e37e88bf5cb Mon Sep 17 00:00:00 2001 From: Tomasz Lelek Date: Thu, 26 Jan 2017 21:47:52 +0100 Subject: [PATCH] BAEL-542 test fix --- .../cachecontrol/ResourceEndpoint.java | 1 - .../cachecontrol/ResourceEndpointTest.java | 20 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/spring-security-cache-control/src/main/java/com/baeldung/cachecontrol/ResourceEndpoint.java b/spring-security-cache-control/src/main/java/com/baeldung/cachecontrol/ResourceEndpoint.java index 86f9747e1c..f1c9786c68 100644 --- a/spring-security-cache-control/src/main/java/com/baeldung/cachecontrol/ResourceEndpoint.java +++ b/spring-security-cache-control/src/main/java/com/baeldung/cachecontrol/ResourceEndpoint.java @@ -29,7 +29,6 @@ public class ResourceEndpoint { public ResponseEntity getServerTimestamp() { return ResponseEntity.ok() .cacheControl(CacheControl.noStore()) - .cacheControl(CacheControl.noCache()) .body(new TimestampDto(LocalDateTime.now().toInstant(ZoneOffset.UTC).toEpochMilli())); } diff --git a/spring-security-cache-control/src/test/java/com/baeldung/cachecontrol/ResourceEndpointTest.java b/spring-security-cache-control/src/test/java/com/baeldung/cachecontrol/ResourceEndpointTest.java index d0a15efb2b..e85dd11667 100644 --- a/spring-security-cache-control/src/test/java/com/baeldung/cachecontrol/ResourceEndpointTest.java +++ b/spring-security-cache-control/src/test/java/com/baeldung/cachecontrol/ResourceEndpointTest.java @@ -14,15 +14,15 @@ import static com.jayway.restassured.RestAssured.given; public class ResourceEndpointTest { private static final String URL_PREFIX = "http://localhost:8080"; - @Test - public void givenServiceEndpoint_whenGetRequestForUser_shouldResponseWithCacheControlMaxAge() { - given() - .when() - .get(URL_PREFIX + "/users/Michael") - .then() - .contentType(ContentType.JSON).and().statusCode(200).and() - .header("Cache-Control", "max-age=60"); - } + @Test + public void givenServiceEndpoint_whenGetRequestForUser_shouldResponseWithCacheControlMaxAge() { + given() + .when() + .get(URL_PREFIX + "/users/Michael") + .then() + .contentType(ContentType.JSON).and().statusCode(200).and() + .header("Cache-Control", "max-age=60"); + } @Test public void givenServiceEndpoint_whenGetRequestForNotCacheableContent_shouldResponseWithCacheControlNoCache() { @@ -31,7 +31,7 @@ public class ResourceEndpointTest { .get(URL_PREFIX + "/timestamp") .then() .contentType(ContentType.JSON).and().statusCode(200).and() - .header("Cache-Control", "no-cache"); + .header("Cache-Control", "no-store"); } @Test