From f7d4422d8ff6f76d62f447c5bb077511a1576e4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=CC=88rg=20Prante?= Date: Thu, 29 Aug 2019 16:05:58 +0200 Subject: [PATCH] update to xbib net 2.0.1 --- .../xbib/content/settings/SettingsTest.java | 25 +++++++++++++++++++ gradle.properties | 4 +-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/content-core/src/test/java/org/xbib/content/settings/SettingsTest.java b/content-core/src/test/java/org/xbib/content/settings/SettingsTest.java index 6a18d64..8ca2f8b 100644 --- a/content-core/src/test/java/org/xbib/content/settings/SettingsTest.java +++ b/content-core/src/test/java/org/xbib/content/settings/SettingsTest.java @@ -12,15 +12,20 @@ import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.StringReader; import java.nio.charset.StandardCharsets; +import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; +import java.util.List; import java.util.Map; +import java.util.logging.Logger; /** * */ public class SettingsTest extends Assert { + private static final Logger logger = Logger.getLogger(SettingsTest.class.getName()); + @Test public void testEmpty() { Settings settings = Settings.EMPTY_SETTINGS; @@ -36,6 +41,26 @@ public class SettingsTest extends Assert { assertEquals("c", settings.getAsArray("input")[2]); } + @SuppressWarnings("unchecked") + @Test + public void testArrayOfMaps() { + Settings settings = Settings.settingsBuilder() + .put("location.0.code", "Code 0") + .put("location.0.name", "Name 0") + .put("location.1.code", "Code 1") + .put("location.1.name", "Name 1") + .build(); + + // turn map with index keys 0,1,... into a list of maps + Map map = settings.getAsSettings("location").getAsStructuredMap(); + List> list = new ArrayList<>(); + for (Map.Entry entry : map.entrySet()) { + list.add((Map) entry.getValue()); + } + logger.info(list.toString()); + assertEquals("[{name=Name 0, code=Code 0}, {name=Name 1, code=Code 1}]", list.toString()); + } + @Test public void testGroups() { Settings settings = Settings.settingsBuilder() diff --git a/gradle.properties b/gradle.properties index b513960..670a470 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,8 +1,8 @@ group = org.xbib name = content -version = 2.0.0 +version = 2.0.1 -xbib-net.version = 2.0.0 +xbib-net.version = 2.0.1 jackson.version = 2.9.9 jackson-databind.version = 2.9.9.2