From fe129c06f3a518bfadc1176d5d723c36ab5bd463 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Mon, 19 Feb 2024 14:50:34 +0100 Subject: [PATCH] test: Added missing JSR-310 module to not Spring-Boot-based tests --- .../inmemory/ShardedChatHomeServiceTest.java | 15 +++++++++++++-- .../inmemory/SimpleChatHomeServiceTest.java | 15 +++++++++++++-- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/test/java/de/juplo/kafka/chat/backend/implementation/inmemory/ShardedChatHomeServiceTest.java b/src/test/java/de/juplo/kafka/chat/backend/implementation/inmemory/ShardedChatHomeServiceTest.java index b830f300..8ed18448 100644 --- a/src/test/java/de/juplo/kafka/chat/backend/implementation/inmemory/ShardedChatHomeServiceTest.java +++ b/src/test/java/de/juplo/kafka/chat/backend/implementation/inmemory/ShardedChatHomeServiceTest.java @@ -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 diff --git a/src/test/java/de/juplo/kafka/chat/backend/implementation/inmemory/SimpleChatHomeServiceTest.java b/src/test/java/de/juplo/kafka/chat/backend/implementation/inmemory/SimpleChatHomeServiceTest.java index d90696dd..b967df82 100644 --- a/src/test/java/de/juplo/kafka/chat/backend/implementation/inmemory/SimpleChatHomeServiceTest.java +++ b/src/test/java/de/juplo/kafka/chat/backend/implementation/inmemory/SimpleChatHomeServiceTest.java @@ -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 -- 2.20.1