From 4945d09e4c5bde9773c6ac20451959173c6816e7 Mon Sep 17 00:00:00 2001 From: Francesco Cesareo Date: Thu, 21 Nov 2024 23:09:45 +0100 Subject: [PATCH] added unit test --- openapi/openapi_export.json | 18 ++-- openapi/openapi_fdrv1.json | 94 +++++++++---------- openapi/openapi_nodev1.json | 94 +++++++++---------- openapi/openapi_standinv1.json | 94 +++++++++---------- openapi/openapi_verifierv1.json | 6 +- .../service/StakeholderConfigService.java | 5 +- .../apiconfig/cache/util/ConfigMapper.java | 1 + .../cache/StakeholderConfigServiceTest.java | 53 +++++++---- .../gov/pagopa/apiconfig/cache/TestUtils.java | 2 +- .../cache/controller/CacheControllerTest.java | 6 +- .../StakeholderCacheControllerTest.java | 8 +- 11 files changed, 202 insertions(+), 179 deletions(-) diff --git a/openapi/openapi_export.json b/openapi/openapi_export.json index 2146cf0f..758ca723 100644 --- a/openapi/openapi_export.json +++ b/openapi/openapi_export.json @@ -26,6 +26,12 @@ "summary" : "Get xlsx of full cache", "operationId" : "xls", "responses" : { + "200" : { + "description" : "OK", + "content" : { + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" : { } + } + }, "403" : { "description" : "Forbidden" }, @@ -42,15 +48,6 @@ } } }, - "200" : { - "description" : "OK", - "content" : { - "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" : { } - } - }, - "401" : { - "description" : "Unauthorized" - }, "400" : { "description" : "Bad Request", "content" : { @@ -60,6 +57,9 @@ } } } + }, + "401" : { + "description" : "Unauthorized" } }, "security" : [ { diff --git a/openapi/openapi_fdrv1.json b/openapi/openapi_fdrv1.json index a9889233..d83cbe09 100644 --- a/openapi/openapi_fdrv1.json +++ b/openapi/openapi_fdrv1.json @@ -36,6 +36,16 @@ } } ], "responses" : { + "200" : { + "description" : "OK", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ConfigDataV1" + } + } + } + }, "403" : { "description" : "Forbidden" }, @@ -52,19 +62,6 @@ } } }, - "401" : { - "description" : "Unauthorized" - }, - "200" : { - "description" : "OK", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ConfigDataV1" - } - } - } - }, "400" : { "description" : "Bad Request", "content" : { @@ -74,6 +71,9 @@ } } } + }, + "401" : { + "description" : "Unauthorized" } }, "security" : [ { @@ -87,6 +87,12 @@ "summary" : "Get xlsx of last v1 {stakeholder} cache version", "operationId" : "xls", "responses" : { + "200" : { + "description" : "OK", + "content" : { + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" : { } + } + }, "403" : { "description" : "Forbidden" }, @@ -103,15 +109,6 @@ } } }, - "200" : { - "description" : "OK", - "content" : { - "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" : { } - } - }, - "401" : { - "description" : "Unauthorized" - }, "400" : { "description" : "Bad Request", "content" : { @@ -121,6 +118,9 @@ } } } + }, + "401" : { + "description" : "Unauthorized" } }, "security" : [ { @@ -163,9 +163,6 @@ } } }, - "401" : { - "description" : "Unauthorized" - }, "400" : { "description" : "Bad Request", "content" : { @@ -175,6 +172,9 @@ } } } + }, + "401" : { + "description" : "Unauthorized" } }, "security" : [ { @@ -185,28 +185,6 @@ }, "components" : { "schemas" : { - "ProblemJson" : { - "type" : "object", - "properties" : { - "title" : { - "type" : "string", - "description" : "A short, summary of the problem type. Written in english and readable for engineers (usually not suited for non technical stakeholders and not localized); example: Service Unavailable" - }, - "status" : { - "maximum" : 600, - "minimum" : 100, - "type" : "integer", - "description" : "The HTTP status code generated by the origin server for this occurrence of the problem.", - "format" : "int32", - "example" : 200 - }, - "detail" : { - "type" : "string", - "description" : "A human readable explanation specific to this occurrence of the problem.", - "example" : "There was an error processing the request" - } - } - }, "BrokerCreditorInstitution" : { "required" : [ "broker_code", "enabled", "extended_fault_bean" ], "type" : "object", @@ -1058,6 +1036,28 @@ } } }, + "ProblemJson" : { + "type" : "object", + "properties" : { + "title" : { + "type" : "string", + "description" : "A short, summary of the problem type. Written in english and readable for engineers (usually not suited for non technical stakeholders and not localized); example: Service Unavailable" + }, + "status" : { + "maximum" : 600, + "minimum" : 100, + "type" : "integer", + "description" : "The HTTP status code generated by the origin server for this occurrence of the problem.", + "format" : "int32", + "example" : 200 + }, + "detail" : { + "type" : "string", + "description" : "A human readable explanation specific to this occurrence of the problem.", + "example" : "There was an error processing the request" + } + } + }, "CacheVersion" : { "required" : [ "version" ], "type" : "object", diff --git a/openapi/openapi_nodev1.json b/openapi/openapi_nodev1.json index 7dd80fb3..0eb5c785 100644 --- a/openapi/openapi_nodev1.json +++ b/openapi/openapi_nodev1.json @@ -36,6 +36,16 @@ } } ], "responses" : { + "200" : { + "description" : "OK", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ConfigDataV1" + } + } + } + }, "403" : { "description" : "Forbidden" }, @@ -52,19 +62,6 @@ } } }, - "401" : { - "description" : "Unauthorized" - }, - "200" : { - "description" : "OK", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ConfigDataV1" - } - } - } - }, "400" : { "description" : "Bad Request", "content" : { @@ -74,6 +71,9 @@ } } } + }, + "401" : { + "description" : "Unauthorized" } }, "security" : [ { @@ -87,6 +87,12 @@ "summary" : "Get xlsx of last v1 {stakeholder} cache version", "operationId" : "xls", "responses" : { + "200" : { + "description" : "OK", + "content" : { + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" : { } + } + }, "403" : { "description" : "Forbidden" }, @@ -103,15 +109,6 @@ } } }, - "200" : { - "description" : "OK", - "content" : { - "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" : { } - } - }, - "401" : { - "description" : "Unauthorized" - }, "400" : { "description" : "Bad Request", "content" : { @@ -121,6 +118,9 @@ } } } + }, + "401" : { + "description" : "Unauthorized" } }, "security" : [ { @@ -163,9 +163,6 @@ } } }, - "401" : { - "description" : "Unauthorized" - }, "400" : { "description" : "Bad Request", "content" : { @@ -175,6 +172,9 @@ } } } + }, + "401" : { + "description" : "Unauthorized" } }, "security" : [ { @@ -185,28 +185,6 @@ }, "components" : { "schemas" : { - "ProblemJson" : { - "type" : "object", - "properties" : { - "title" : { - "type" : "string", - "description" : "A short, summary of the problem type. Written in english and readable for engineers (usually not suited for non technical stakeholders and not localized); example: Service Unavailable" - }, - "status" : { - "maximum" : 600, - "minimum" : 100, - "type" : "integer", - "description" : "The HTTP status code generated by the origin server for this occurrence of the problem.", - "format" : "int32", - "example" : 200 - }, - "detail" : { - "type" : "string", - "description" : "A human readable explanation specific to this occurrence of the problem.", - "example" : "There was an error processing the request" - } - } - }, "BrokerCreditorInstitution" : { "required" : [ "broker_code", "enabled", "extended_fault_bean" ], "type" : "object", @@ -1058,6 +1036,28 @@ } } }, + "ProblemJson" : { + "type" : "object", + "properties" : { + "title" : { + "type" : "string", + "description" : "A short, summary of the problem type. Written in english and readable for engineers (usually not suited for non technical stakeholders and not localized); example: Service Unavailable" + }, + "status" : { + "maximum" : 600, + "minimum" : 100, + "type" : "integer", + "description" : "The HTTP status code generated by the origin server for this occurrence of the problem.", + "format" : "int32", + "example" : 200 + }, + "detail" : { + "type" : "string", + "description" : "A human readable explanation specific to this occurrence of the problem.", + "example" : "There was an error processing the request" + } + } + }, "CacheVersion" : { "required" : [ "version" ], "type" : "object", diff --git a/openapi/openapi_standinv1.json b/openapi/openapi_standinv1.json index f542f058..4f8fb0d7 100644 --- a/openapi/openapi_standinv1.json +++ b/openapi/openapi_standinv1.json @@ -36,6 +36,16 @@ } } ], "responses" : { + "200" : { + "description" : "OK", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ConfigDataV1" + } + } + } + }, "403" : { "description" : "Forbidden" }, @@ -52,19 +62,6 @@ } } }, - "401" : { - "description" : "Unauthorized" - }, - "200" : { - "description" : "OK", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ConfigDataV1" - } - } - } - }, "400" : { "description" : "Bad Request", "content" : { @@ -74,6 +71,9 @@ } } } + }, + "401" : { + "description" : "Unauthorized" } }, "security" : [ { @@ -87,6 +87,12 @@ "summary" : "Get xlsx of last v1 {stakeholder} cache version", "operationId" : "xls", "responses" : { + "200" : { + "description" : "OK", + "content" : { + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" : { } + } + }, "403" : { "description" : "Forbidden" }, @@ -103,15 +109,6 @@ } } }, - "200" : { - "description" : "OK", - "content" : { - "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" : { } - } - }, - "401" : { - "description" : "Unauthorized" - }, "400" : { "description" : "Bad Request", "content" : { @@ -121,6 +118,9 @@ } } } + }, + "401" : { + "description" : "Unauthorized" } }, "security" : [ { @@ -163,9 +163,6 @@ } } }, - "401" : { - "description" : "Unauthorized" - }, "400" : { "description" : "Bad Request", "content" : { @@ -175,6 +172,9 @@ } } } + }, + "401" : { + "description" : "Unauthorized" } }, "security" : [ { @@ -185,28 +185,6 @@ }, "components" : { "schemas" : { - "ProblemJson" : { - "type" : "object", - "properties" : { - "title" : { - "type" : "string", - "description" : "A short, summary of the problem type. Written in english and readable for engineers (usually not suited for non technical stakeholders and not localized); example: Service Unavailable" - }, - "status" : { - "maximum" : 600, - "minimum" : 100, - "type" : "integer", - "description" : "The HTTP status code generated by the origin server for this occurrence of the problem.", - "format" : "int32", - "example" : 200 - }, - "detail" : { - "type" : "string", - "description" : "A human readable explanation specific to this occurrence of the problem.", - "example" : "There was an error processing the request" - } - } - }, "BrokerCreditorInstitution" : { "required" : [ "broker_code", "enabled", "extended_fault_bean" ], "type" : "object", @@ -1058,6 +1036,28 @@ } } }, + "ProblemJson" : { + "type" : "object", + "properties" : { + "title" : { + "type" : "string", + "description" : "A short, summary of the problem type. Written in english and readable for engineers (usually not suited for non technical stakeholders and not localized); example: Service Unavailable" + }, + "status" : { + "maximum" : 600, + "minimum" : 100, + "type" : "integer", + "description" : "The HTTP status code generated by the origin server for this occurrence of the problem.", + "format" : "int32", + "example" : 200 + }, + "detail" : { + "type" : "string", + "description" : "A human readable explanation specific to this occurrence of the problem.", + "example" : "There was an error processing the request" + } + } + }, "CacheVersion" : { "required" : [ "version" ], "type" : "object", diff --git a/openapi/openapi_verifierv1.json b/openapi/openapi_verifierv1.json index e14e6560..70404fd9 100644 --- a/openapi/openapi_verifierv1.json +++ b/openapi/openapi_verifierv1.json @@ -52,9 +52,6 @@ } } }, - "401" : { - "description" : "Unauthorized" - }, "400" : { "description" : "Bad Request", "content" : { @@ -64,6 +61,9 @@ } } } + }, + "401" : { + "description" : "Unauthorized" } }, "security" : [ { diff --git a/src/main/java/it/gov/pagopa/apiconfig/cache/service/StakeholderConfigService.java b/src/main/java/it/gov/pagopa/apiconfig/cache/service/StakeholderConfigService.java index 8d153f88..6d72b752 100644 --- a/src/main/java/it/gov/pagopa/apiconfig/cache/service/StakeholderConfigService.java +++ b/src/main/java/it/gov/pagopa/apiconfig/cache/service/StakeholderConfigService.java @@ -127,6 +127,7 @@ public void saveOnDB(ConfigData configData, String schemaVersion) { try { String cacheVersion = getGZIPVersion(schemaVersion); ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.registerModule(new JavaTimeModule()); HashMap cloned = objectMapper.convertValue(configData.getConfigDataV1(), HashMap.class); cacheRepository.save(Cache.builder() .id(configData.getXCacheId()) @@ -189,7 +190,7 @@ private String getStakeholderWithSchema(String stakeholder, String schemaVersion return String.format("%s_%s", stakeholder, schemaVersion); } - private ConfigDataV1 cacheToConfigDataV1(Map inMemoryCache, String[] keys) { + public ConfigDataV1 cacheToConfigDataV1(Map inMemoryCache, String[] keys) { ObjectMapper objectMapper = new ObjectMapper(); objectMapper.registerModule(new JavaTimeModule()); objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); @@ -221,7 +222,7 @@ private static ConfigData decompressGzipToConfigData(byte[] gzipBytes) throws IO jsonParser.close(); return configData; } - private static byte[] compressJsonToGzip(Object object) throws IOException { + public static byte[] compressJsonToGzip(Object object) throws IOException { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); // use GZIPOutputStream to compress data diff --git a/src/main/java/it/gov/pagopa/apiconfig/cache/util/ConfigMapper.java b/src/main/java/it/gov/pagopa/apiconfig/cache/util/ConfigMapper.java index ed9b9244..e95c5c28 100644 --- a/src/main/java/it/gov/pagopa/apiconfig/cache/util/ConfigMapper.java +++ b/src/main/java/it/gov/pagopa/apiconfig/cache/util/ConfigMapper.java @@ -1,5 +1,6 @@ package it.gov.pagopa.apiconfig.cache.util; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import it.gov.pagopa.apiconfig.cache.model.latest.cds.CdsService; import it.gov.pagopa.apiconfig.cache.model.latest.cds.CdsSubjectService; import it.gov.pagopa.apiconfig.cache.model.latest.configuration.ConfigurationKey; diff --git a/src/test/java/it/gov/pagopa/apiconfig/cache/StakeholderConfigServiceTest.java b/src/test/java/it/gov/pagopa/apiconfig/cache/StakeholderConfigServiceTest.java index 8bea581e..b61e3b95 100644 --- a/src/test/java/it/gov/pagopa/apiconfig/cache/StakeholderConfigServiceTest.java +++ b/src/test/java/it/gov/pagopa/apiconfig/cache/StakeholderConfigServiceTest.java @@ -3,7 +3,11 @@ import it.gov.pagopa.apiconfig.Application; import it.gov.pagopa.apiconfig.cache.controller.CacheController; import it.gov.pagopa.apiconfig.cache.controller.stakeholders.NodeCacheController; +import it.gov.pagopa.apiconfig.cache.exception.AppError; +import it.gov.pagopa.apiconfig.cache.exception.AppException; import it.gov.pagopa.apiconfig.cache.model.ConfigData; +import it.gov.pagopa.apiconfig.cache.model.node.CacheVersion; +import it.gov.pagopa.apiconfig.cache.model.node.v1.ConfigDataV1; import it.gov.pagopa.apiconfig.cache.redis.RedisRepository; import it.gov.pagopa.apiconfig.cache.service.CacheEventHubService; import it.gov.pagopa.apiconfig.cache.service.CacheConfigService; @@ -27,6 +31,7 @@ import java.time.ZoneId; import java.time.ZonedDateTime; +import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy; import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; @@ -133,24 +138,38 @@ void saveOnDB() throws IOException { stakeholderConfigService.saveOnDB(configData, "v1"); assertThat(configData).isNotNull(); } + @Test + void getVersionId() { + String version = "111"; + when(redisRepository.get(any())).thenReturn(version.getBytes(StandardCharsets.UTF_8)); + CacheVersion cacheVersion = stakeholderConfigService.getVersionId("test", "v1"); + assertThat(cacheVersion.getVersion()).isEqualTo(version); + } -// @Test -// void getCacheV1Id() throws IOException { -// Map configDataV1Map = new HashMap<>(); -// configDataV1Map.put(Constants.version,"12345"); -// ConfigDataV1 configDataV11 = new ConfigDataV1(); -// configDataV11.setVersion("12345"); -// when(redisRepository.getStringByKeyId(anyString())).thenReturn(TestUtils.cacheId); -// when(redisRepository.getBooleanByKeyId(anyString())).thenReturn(true); -// when(redisRepository.get(anyString())).thenReturn(configDataV1Map); -// CacheVersion cacheV1Id = configService.getCacheV1Id(""); -// assertThat(cacheV1Id.getVersion().equals(TestUtils.cacheId)); -// Boolean inProgress = configService.getCacheV1InProgress(""); -// assertThat(inProgress); -// -// Map configDataV1 = configService.loadFullCache(); -// assertThat(configDataV1.get(Constants.version).equals(configDataV11.getVersion())); -// } + @Test + void getXLSX() throws IOException { + String version = "111"; + String cacheVersion = Constants.GZIP_JSON + "-test"; + ZonedDateTime now = ZonedDateTime.now(); + ZonedDateTime romeDateTime = now.withZoneSameInstant(ZoneId.of("Europe/Rome")); + ConfigMapper modelMapper = new ConfigMapper(); + ConfigDataV1 configDataV1 = stakeholderConfigService.cacheToConfigDataV1( + TestUtils.inMemoryCache( + modelMapper, version, cacheVersion, romeDateTime + ), + new String[]{} + ); + ConfigData configData = ConfigData.builder() + .configDataV1(configDataV1) + .xCacheId(version) + .xCacheTimestamp(romeDateTime.toString()) + .xCacheVersion(cacheVersion) + .build(); + + when(redisRepository.get(any())).thenReturn(stakeholderConfigService.compressJsonToGzip(configData)); + + assertThat(stakeholderConfigService.getXLSX("test", "v1")).isNotNull(); + } // @Test // void testXls() throws Exception { diff --git a/src/test/java/it/gov/pagopa/apiconfig/cache/TestUtils.java b/src/test/java/it/gov/pagopa/apiconfig/cache/TestUtils.java index 7f9ef6af..cd4afded 100644 --- a/src/test/java/it/gov/pagopa/apiconfig/cache/TestUtils.java +++ b/src/test/java/it/gov/pagopa/apiconfig/cache/TestUtils.java @@ -1,6 +1,7 @@ package it.gov.pagopa.apiconfig.cache; import it.gov.pagopa.apiconfig.cache.controller.CacheController; +import it.gov.pagopa.apiconfig.cache.model.ConfigData; import it.gov.pagopa.apiconfig.cache.model.latest.creditorinstitution.Station; import it.gov.pagopa.apiconfig.cache.model.latest.psp.Channel; import it.gov.pagopa.apiconfig.cache.util.ConfigMapper; @@ -56,7 +57,6 @@ public static HashMap inMemoryCache(ConfigMapper modelMapper, ))); return objectObjectHashMap; } - public static List pastazioniV2 = Arrays.asList("1", "2", "3", "4"); public static String cacheId = "testCacheId"; diff --git a/src/test/java/it/gov/pagopa/apiconfig/cache/controller/CacheControllerTest.java b/src/test/java/it/gov/pagopa/apiconfig/cache/controller/CacheControllerTest.java index 094e0e18..1099f8eb 100644 --- a/src/test/java/it/gov/pagopa/apiconfig/cache/controller/CacheControllerTest.java +++ b/src/test/java/it/gov/pagopa/apiconfig/cache/controller/CacheControllerTest.java @@ -23,6 +23,7 @@ import javax.persistence.EntityManager; import java.time.ZoneId; import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; import static org.mockito.Mockito.when; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; @@ -69,13 +70,14 @@ void testGets(String url) throws Exception { String cacheVersion = Constants.GZIP_JSON + "-test"; ZonedDateTime now = ZonedDateTime.now(); ZonedDateTime romeDateTime = now.withZoneSameInstant(ZoneId.of("Europe/Rome")); - TestUtils.inizializeInMemoryCache(cacheController, modelMapper, version, cacheVersion, romeDateTime); + TestUtils.inizializeInMemoryCache(cacheController, modelMapper, version, cacheVersion, romeDateTime); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSSSSXXXXX'['VV']'"); mvc.perform(get(url).contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andExpect(header().string(Constants.HEADER_X_CACHE_ID, version)) .andExpect(header().string(Constants.HEADER_X_CACHE_VERSION, cacheVersion)) - .andExpect(header().string(Constants.HEADER_X_CACHE_TIMESTAMP, romeDateTime.toString())) + .andExpect(header().string(Constants.HEADER_X_CACHE_TIMESTAMP, formatter.format(romeDateTime))) ; } diff --git a/src/test/java/it/gov/pagopa/apiconfig/cache/controller/StakeholderCacheControllerTest.java b/src/test/java/it/gov/pagopa/apiconfig/cache/controller/StakeholderCacheControllerTest.java index ed2dd93a..d110e7a9 100644 --- a/src/test/java/it/gov/pagopa/apiconfig/cache/controller/StakeholderCacheControllerTest.java +++ b/src/test/java/it/gov/pagopa/apiconfig/cache/controller/StakeholderCacheControllerTest.java @@ -29,6 +29,7 @@ import java.nio.charset.StandardCharsets; import java.time.ZoneId; import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; @@ -73,22 +74,21 @@ void testCache(String url) throws Exception { String cacheVersion = Constants.GZIP_JSON + "-test"; ZonedDateTime now = ZonedDateTime.now(); ZonedDateTime romeDateTime = now.withZoneSameInstant(ZoneId.of("Europe/Rome")); - + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSSSSXXXXX'['VV']'"); ConfigDataV1 cd = new ConfigDataV1(); cd.setVersion("version1"); ConfigData configData = ConfigData.builder() .xCacheId(version) - .xCacheTimestamp(romeDateTime.toString()) + .xCacheTimestamp(formatter.format(romeDateTime)) .xCacheVersion(cacheVersion) .configDataV1(cd) .build(); when(stakeholderConfigService.getCache(anyString(), anyString(), any())).thenReturn(configData); - mvc.perform(get(url).contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andExpect(header().string(Constants.HEADER_X_CACHE_ID, version)) .andExpect(header().string(Constants.HEADER_X_CACHE_VERSION, cacheVersion)) - .andExpect(header().string(Constants.HEADER_X_CACHE_TIMESTAMP, romeDateTime.toString())) + .andExpect(header().string(Constants.HEADER_X_CACHE_TIMESTAMP, formatter.format(romeDateTime))) ; }