TMP
authorKai Moritz <kai@juplo.de>
Fri, 23 Feb 2024 15:09:50 +0000 (16:09 +0100)
committerKai Moritz <kai@juplo.de>
Fri, 23 Feb 2024 15:13:05 +0000 (16:13 +0100)
src/test/java/de/juplo/kafka/chat/backend/InMemoryWithFilesStorageIT.java

index e4eaf3a..0d63b7e 100644 (file)
@@ -1,8 +1,13 @@
 package de.juplo.kafka.chat.backend;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
 import lombok.extern.slf4j.Slf4j;
 import org.junit.jupiter.api.BeforeEach;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.TestPropertySource;
 
 import java.io.IOException;
@@ -15,6 +20,7 @@ import java.nio.file.Paths;
     "chat.backend.inmemory.sharding-strategy=none",
     "chat.backend.inmemory.storage-strategy=files",
     "chat.backend.inmemory.storage-directory=target/files" })
+@ContextConfiguration(classes = InMemoryWithFilesStorageIT.TestConfig.class)
 @Slf4j
 public class InMemoryWithFilesStorageIT extends AbstractInMemoryStorageIT
 {
@@ -47,4 +53,17 @@ public class InMemoryWithFilesStorageIT extends AbstractInMemoryStorageIT
       Files.delete(path);
     }
   }
+
+
+  static class TestConfig
+  {
+    @Bean
+    ObjectMapper objectMapper()
+    {
+      ObjectMapper objectMapper = new ObjectMapper();
+      objectMapper.registerModule(new JavaTimeModule());
+      objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
+      return objectMapper;
+    }
+  }
 }