test: Added missing JSR-310 module to not Spring-Boot-based tests
authorKai Moritz <kai@juplo.de>
Mon, 19 Feb 2024 13:50:34 +0000 (14:50 +0100)
committerKai Moritz <kai@juplo.de>
Tue, 20 Feb 2024 09:37:36 +0000 (10:37 +0100)
src/test/java/de/juplo/kafka/chat/backend/implementation/inmemory/ShardedChatHomeServiceTest.java
src/test/java/de/juplo/kafka/chat/backend/implementation/inmemory/SimpleChatHomeServiceTest.java

index b830f30..8ed1844 100644 (file)
@@ -1,6 +1,7 @@
 package de.juplo.kafka.chat.backend.implementation.inmemory;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
 import de.juplo.kafka.chat.backend.domain.ChatHomeServiceWithShardsTest;
 import de.juplo.kafka.chat.backend.implementation.ShardingStrategy;
 import de.juplo.kafka.chat.backend.implementation.StorageStrategy;
@@ -47,12 +48,22 @@ public class ShardedChatHomeServiceTest extends ChatHomeServiceWithShardsTest
     }
 
     @Bean
-    public FilesStorageStrategy storageStrategy(Clock clock)
+    FilesStorageStrategy storageStrategy(
+        Clock clock,
+        ObjectMapper objectMapper)
     {
       return new FilesStorageStrategy(
           Paths.get("target", "test-classes", "data", "files"),
           new KafkaLikeShardingStrategy(NUM_SHARDS),
-          new ObjectMapper());
+          objectMapper);
+    }
+
+    @Bean
+    ObjectMapper objectMapper()
+    {
+      ObjectMapper objectMapper = new ObjectMapper();
+      objectMapper.registerModule(new JavaTimeModule());
+      return objectMapper;
     }
 
     @Bean
index d90696d..b967df8 100644 (file)
@@ -1,6 +1,7 @@
 package de.juplo.kafka.chat.backend.implementation.inmemory;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
 import de.juplo.kafka.chat.backend.domain.ChatHomeServiceTest;
 import de.juplo.kafka.chat.backend.implementation.StorageStrategy;
 import de.juplo.kafka.chat.backend.storage.files.FilesStorageStrategy;
@@ -28,12 +29,22 @@ public class SimpleChatHomeServiceTest extends ChatHomeServiceTest
     }
 
     @Bean
-    public FilesStorageStrategy storageStrategy(Clock clock)
+    FilesStorageStrategy storageStrategy(
+        Clock clock,
+        ObjectMapper objectMapper)
     {
       return new FilesStorageStrategy(
           Paths.get("target", "test-classes", "data", "files"),
           chatRoomId -> 0,
-          new ObjectMapper());
+          objectMapper);
+    }
+
+    @Bean
+    ObjectMapper objectMapper()
+    {
+      ObjectMapper objectMapper = new ObjectMapper();
+      objectMapper.registerModule(new JavaTimeModule());
+      return objectMapper;
     }
 
     @Bean