From 1fdf265ee664c0b9396dbe01e4fa24942d996763 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Fri, 4 Nov 2022 08:25:08 +0100 Subject: [PATCH] WIP:StringDeserializer --- src/main/java/de/juplo/kafka/Message.java | 9 ----- .../java/de/juplo/kafka/MessageAddNumber.java | 19 --------- .../de/juplo/kafka/MessageCalculateSum.java | 16 -------- src/test/java/de/juplo/kafka/MessageTest.java | 39 ------------------- 4 files changed, 83 deletions(-) delete mode 100644 src/main/java/de/juplo/kafka/Message.java delete mode 100644 src/main/java/de/juplo/kafka/MessageAddNumber.java delete mode 100644 src/main/java/de/juplo/kafka/MessageCalculateSum.java delete mode 100644 src/test/java/de/juplo/kafka/MessageTest.java diff --git a/src/main/java/de/juplo/kafka/Message.java b/src/main/java/de/juplo/kafka/Message.java deleted file mode 100644 index e4999b7..0000000 --- a/src/main/java/de/juplo/kafka/Message.java +++ /dev/null @@ -1,9 +0,0 @@ -package de.juplo.kafka; - - -public abstract class Message -{ - public enum Type {ADD, CALC} - - public abstract Type getType(); -} diff --git a/src/main/java/de/juplo/kafka/MessageAddNumber.java b/src/main/java/de/juplo/kafka/MessageAddNumber.java deleted file mode 100644 index c024b65..0000000 --- a/src/main/java/de/juplo/kafka/MessageAddNumber.java +++ /dev/null @@ -1,19 +0,0 @@ -package de.juplo.kafka; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import lombok.Data; - - -@Data -@JsonIgnoreProperties(ignoreUnknown = true) -public class MessageAddNumber extends Message -{ - private Integer next; - - - @Override - public Type getType() - { - return Type.ADD; - } -} diff --git a/src/main/java/de/juplo/kafka/MessageCalculateSum.java b/src/main/java/de/juplo/kafka/MessageCalculateSum.java deleted file mode 100644 index afc5a39..0000000 --- a/src/main/java/de/juplo/kafka/MessageCalculateSum.java +++ /dev/null @@ -1,16 +0,0 @@ -package de.juplo.kafka; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import lombok.Data; - - -@Data -@JsonIgnoreProperties(ignoreUnknown = true) -public class MessageCalculateSum extends Message -{ - @Override - public Type getType() - { - return Type.CALC; - } -} diff --git a/src/test/java/de/juplo/kafka/MessageTest.java b/src/test/java/de/juplo/kafka/MessageTest.java deleted file mode 100644 index 52794ba..0000000 --- a/src/test/java/de/juplo/kafka/MessageTest.java +++ /dev/null @@ -1,39 +0,0 @@ -package de.juplo.kafka; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.Arguments; -import org.junit.jupiter.params.provider.MethodSource; -import org.junit.jupiter.params.provider.ValueSource; - -import java.util.Arrays; -import java.util.stream.IntStream; -import java.util.stream.Stream; - -import static org.assertj.core.api.Assertions.*; - - -public class MessageTest -{ - ObjectMapper mapper = new ObjectMapper(); - - @Test - @DisplayName("Deserialize a MessageAddNumber message") - public void testDeserializeMessageAddNumber() - { - Assertions.assertDoesNotThrow(() -> mapper.readValue("{\"next\":42}", MessageAddNumber.class)); - Assertions.assertDoesNotThrow(() -> mapper.readValue("{\"number\":666,\"next\":42}", MessageAddNumber.class)); - } - - @Test - @DisplayName("Deserialize a MessageCalculateSum message") - public void testDeserializeMessageCalculateSum() throws JsonProcessingException - { - Assertions.assertDoesNotThrow(() -> mapper.readValue("{}", MessageCalculateSum.class)); - Assertions.assertDoesNotThrow(() -> mapper.readValue("{\"number\":666}", MessageCalculateSum.class)); - } -} -- 2.20.1