From dc9595c7aea48583d4bd075b398b4ce68b626965 Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Thu, 25 May 2023 16:37:47 +0200 Subject: test(core): check JSON serialization for some DAO --- .../eaaf/core/impl/utils/HelperClassesTest.java | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/utils/HelperClassesTest.java (limited to 'eaaf_core/src/test') diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/utils/HelperClassesTest.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/utils/HelperClassesTest.java new file mode 100644 index 00000000..eb1848f1 --- /dev/null +++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/utils/HelperClassesTest.java @@ -0,0 +1,30 @@ +package at.gv.egiz.eaaf.core.impl.utils; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.apache.commons.lang3.RandomStringUtils; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.BlockJUnit4ClassRunner; + +import at.gv.egiz.eaaf.core.impl.data.Pair; +import lombok.SneakyThrows; + +@RunWith(BlockJUnit4ClassRunner.class) +public class HelperClassesTest { + + @Test + @SneakyThrows + public void pairTest() { + Pair pair = + Pair.newInstance(RandomStringUtils.randomAlphanumeric(5), RandomStringUtils.randomAlphanumeric(5)); + + String pairJson = DefaultJsonMapper.serialize(pair); + + Pair pairResult = (Pair) DefaultJsonMapper.deserialize(pairJson, Pair.class); + + assertEquals(pair.getFirst(), pairResult.getFirst()); + assertEquals(pair.getSecond(), pairResult.getSecond()); + + } +} -- cgit v1.2.3