1 package de.juplo.kafka.chat.backend.persistence.kafka.messages;
3 import com.fasterxml.jackson.databind.ObjectMapper;
4 import com.fasterxml.jackson.databind.SerializationFeature;
5 import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
6 import org.junit.jupiter.api.BeforeEach;
7 import org.junit.jupiter.api.Test;
9 import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat;
12 public class EventChatMessageReceivedToTest
14 final String json = """
17 "text": "Hallo, ich heiße Peter!",
26 mapper = new ObjectMapper();
27 mapper.registerModule(new JavaTimeModule());
28 mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
32 public void testDeserialization() throws Exception
34 EventChatMessageReceivedTo message = mapper.readValue(json, EventChatMessageReceivedTo.class);
35 assertThat(message.getId()).isEqualTo(1l);
36 assertThat(message.getText()).isEqualTo("Hallo, ich heiße Peter!");
37 assertThat(message.getUser()).isEqualTo("Peter");