diff --git a/src/main/java/org/miracum/streams/ume/obdstofhir/model/StructKey.java b/src/main/java/org/miracum/streams/ume/obdstofhir/model/StructKey.java index 82669849..9d5b4353 100644 --- a/src/main/java/org/miracum/streams/ume/obdstofhir/model/StructKey.java +++ b/src/main/java/org/miracum/streams/ume/obdstofhir/model/StructKey.java @@ -1,16 +1,7 @@ package org.miracum.streams.ume.obdstofhir.model; import java.io.Serializable; -import lombok.AllArgsConstructor; import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -@AllArgsConstructor @Builder -@EqualsAndHashCode -@Getter -public class StructKey implements Serializable { - private String referenzNummer; - private String tumorId; -} +public record StructKey(String referenzNummer, String tumorId) implements Serializable {} diff --git a/src/main/java/org/miracum/streams/ume/obdstofhir/serde/StructKeyStringSerde.java b/src/main/java/org/miracum/streams/ume/obdstofhir/serde/StructKeyStringSerde.java index ec3453af..89dc5814 100644 --- a/src/main/java/org/miracum/streams/ume/obdstofhir/serde/StructKeyStringSerde.java +++ b/src/main/java/org/miracum/streams/ume/obdstofhir/serde/StructKeyStringSerde.java @@ -21,8 +21,8 @@ public Serializer serializer() { } return String.format( "Struct{REFERENZ_NUMMER=\"%s\",TUMOR_ID=\"%s\"}", - null == structKey.getReferenzNummer() ? "" : structKey.getReferenzNummer(), - null == structKey.getTumorId() ? "" : structKey.getTumorId()) + null == structKey.referenzNummer() ? "" : structKey.referenzNummer(), + null == structKey.tumorId() ? "" : structKey.tumorId()) .getBytes(StandardCharsets.UTF_8); }; } diff --git a/src/test/java/org/miracum/streams/ume/obdstofhir/serde/StructKeyStringSerdeTest.java b/src/test/java/org/miracum/streams/ume/obdstofhir/serde/StructKeyStringSerdeTest.java index caa454f9..4a94c925 100644 --- a/src/test/java/org/miracum/streams/ume/obdstofhir/serde/StructKeyStringSerdeTest.java +++ b/src/test/java/org/miracum/streams/ume/obdstofhir/serde/StructKeyStringSerdeTest.java @@ -35,4 +35,12 @@ void shouldDeserializeStructKey() { .getBytes(StandardCharsets.UTF_8)); assertThat(actual).isEqualTo(new StructKey("01234", "1")); } + + @Test + void shouldUseLombokBuilderForStructKeyRecord() { + var expected = new StructKey("01234", "1"); + var actual = StructKey.builder().referenzNummer("01234").tumorId("1").build(); + + assertThat(actual).isEqualTo(expected); + } }