From 3041e0580e96c018c1366d5b8078dcaf370edebe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=CC=88rg=20Prante?= Date: Wed, 13 Oct 2021 17:43:22 +0200 Subject: [PATCH] exact year check --- .../xbib/settings/content/test/SettingsTest.java | 13 +++++++------ .../settings/datastructures/test/SettingsTest.java | 3 ++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/settings-content/src/test/java/org/xbib/settings/content/test/SettingsTest.java b/settings-content/src/test/java/org/xbib/settings/content/test/SettingsTest.java index 643347f..ce341fb 100644 --- a/settings-content/src/test/java/org/xbib/settings/content/test/SettingsTest.java +++ b/settings-content/src/test/java/org/xbib/settings/content/test/SettingsTest.java @@ -1,21 +1,19 @@ package org.xbib.settings.content.test; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; -import org.xbib.settings.SettingsLoader; import org.xbib.content.core.XContentHelper; import org.xbib.content.io.BytesArray; import org.xbib.content.io.BytesReference; -import org.xbib.settings.content.json.JsonSettingsLoader; import org.xbib.content.json.JsonXContent; import org.xbib.settings.Settings; +import org.xbib.settings.SettingsLoader; +import org.xbib.settings.content.json.JsonSettingsLoader; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.StringReader; import java.nio.charset.StandardCharsets; import java.nio.file.Paths; +import java.time.LocalDate; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -23,6 +21,9 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; /** * @@ -112,7 +113,7 @@ public class SettingsTest { .put("date", "${yyyy}") .replacePropertyPlaceholders() .build(); - assertTrue(Integer.parseInt(settings.get("date")) > 2000); + assertEquals(LocalDate.now().getYear(), Integer.parseInt(settings.get("date"))); } @Test diff --git a/settings-datastructures/src/test/java/org/xbib/settings/datastructures/test/SettingsTest.java b/settings-datastructures/src/test/java/org/xbib/settings/datastructures/test/SettingsTest.java index c68bdd0..3bbd94b 100644 --- a/settings-datastructures/src/test/java/org/xbib/settings/datastructures/test/SettingsTest.java +++ b/settings-datastructures/src/test/java/org/xbib/settings/datastructures/test/SettingsTest.java @@ -5,6 +5,7 @@ import org.xbib.settings.Settings; import java.io.ByteArrayInputStream; import java.nio.charset.StandardCharsets; +import java.time.LocalDate; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -85,7 +86,7 @@ public class SettingsTest { .put("date", "${yyyy}") .replacePropertyPlaceholders() .build(); - assertTrue(Integer.parseInt(settings.get("date")) > 2000); + assertEquals(LocalDate.now().getYear(), Integer.parseInt(settings.get("date"))); } @Test