BAEL-542 test fix

This commit is contained in:
Tomasz Lelek 2017-01-26 21:47:52 +01:00 committed by Andrew Morgan
parent c3cc42f458
commit cc70eae896
2 changed files with 10 additions and 11 deletions

View File

@ -29,7 +29,6 @@ public class ResourceEndpoint {
public ResponseEntity<TimestampDto> getServerTimestamp() { public ResponseEntity<TimestampDto> getServerTimestamp() {
return ResponseEntity.ok() return ResponseEntity.ok()
.cacheControl(CacheControl.noStore()) .cacheControl(CacheControl.noStore())
.cacheControl(CacheControl.noCache())
.body(new TimestampDto(LocalDateTime.now().toInstant(ZoneOffset.UTC).toEpochMilli())); .body(new TimestampDto(LocalDateTime.now().toInstant(ZoneOffset.UTC).toEpochMilli()));
} }

View File

@ -14,15 +14,15 @@ import static com.jayway.restassured.RestAssured.given;
public class ResourceEndpointTest { public class ResourceEndpointTest {
private static final String URL_PREFIX = "http://localhost:8080"; private static final String URL_PREFIX = "http://localhost:8080";
@Test @Test
public void givenServiceEndpoint_whenGetRequestForUser_shouldResponseWithCacheControlMaxAge() { public void givenServiceEndpoint_whenGetRequestForUser_shouldResponseWithCacheControlMaxAge() {
given() given()
.when() .when()
.get(URL_PREFIX + "/users/Michael") .get(URL_PREFIX + "/users/Michael")
.then() .then()
.contentType(ContentType.JSON).and().statusCode(200).and() .contentType(ContentType.JSON).and().statusCode(200).and()
.header("Cache-Control", "max-age=60"); .header("Cache-Control", "max-age=60");
} }
@Test @Test
public void givenServiceEndpoint_whenGetRequestForNotCacheableContent_shouldResponseWithCacheControlNoCache() { public void givenServiceEndpoint_whenGetRequestForNotCacheableContent_shouldResponseWithCacheControlNoCache() {
@ -31,7 +31,7 @@ public class ResourceEndpointTest {
.get(URL_PREFIX + "/timestamp") .get(URL_PREFIX + "/timestamp")
.then() .then()
.contentType(ContentType.JSON).and().statusCode(200).and() .contentType(ContentType.JSON).and().statusCode(200).and()
.header("Cache-Control", "no-cache"); .header("Cache-Control", "no-store");
} }
@Test @Test