@Test public void readStringKeyedBooleanMapProperty() throws Exception { String booleanItem1 = prepareElement(BOOL_MAP_TAG_1, String.valueOf(booleanValue)); String booleanItem2 = prepareElement(BOOL_MAP_TAG_2, String.valueOf(DEFAULT_BOOL)); String booleanMapXml = prepareElement(BOOL_TAG, booleanItem1 + booleanItem2); xsr = new XmlSettingsReader(booleanMapXml); Map<String, Boolean> readBooleanMapProperty = xsr.getStringKeyedBooleanMapProperty(BOOL_TAG); assertEquals(2, readBooleanMapProperty.keySet().size()); assertEquals(booleanValue, readBooleanMapProperty .values() .stream() .anyMatch(e -> e == booleanValue)); assertEquals(booleanValue, readBooleanMapProperty .values() .stream() .anyMatch(e -> e == DEFAULT_BOOL)); }
public Map<String, Boolean> getStringKeyedBooleanMapProperty(String tagName) { return getStringKeyedMapProperty(tagName, Boolean::parseBoolean); }
XmlSettingsReader { public Map<String, Boolean> getStringKeyedBooleanMapProperty(String tagName) { return getStringKeyedMapProperty(tagName, Boolean::parseBoolean); } }
XmlSettingsReader { public Map<String, Boolean> getStringKeyedBooleanMapProperty(String tagName) { return getStringKeyedMapProperty(tagName, Boolean::parseBoolean); } XmlSettingsReader(String xmlString); }
XmlSettingsReader { public Map<String, Boolean> getStringKeyedBooleanMapProperty(String tagName) { return getStringKeyedMapProperty(tagName, Boolean::parseBoolean); } XmlSettingsReader(String xmlString); int getIntProperty(String xPathExp, String tagName, int defaultVal); String getStringPropertyByXPath(String xPathExp, String tagName); String getStringPropertyByXPath(String xPathExp, String tagName, String defaultVal); boolean getBooleanProperty(String xPathExp, String tagName, boolean defaultVal); String getStringProperty(String tagName); File getFileProperty(String tagName); String getStringProperty(String tagName, String defaultValue); List<String> getStringListProperty(String tagName); Map<String, Boolean> getStringKeyedBooleanMapProperty(String tagName); Map<String, T> getStringKeyedMapProperty(String tagName, Function<String, T> mapFunction); T getComplexType(String tagName, Class<T> targetClass); }
XmlSettingsReader { public Map<String, Boolean> getStringKeyedBooleanMapProperty(String tagName) { return getStringKeyedMapProperty(tagName, Boolean::parseBoolean); } XmlSettingsReader(String xmlString); int getIntProperty(String xPathExp, String tagName, int defaultVal); String getStringPropertyByXPath(String xPathExp, String tagName); String getStringPropertyByXPath(String xPathExp, String tagName, String defaultVal); boolean getBooleanProperty(String xPathExp, String tagName, boolean defaultVal); String getStringProperty(String tagName); File getFileProperty(String tagName); String getStringProperty(String tagName, String defaultValue); List<String> getStringListProperty(String tagName); Map<String, Boolean> getStringKeyedBooleanMapProperty(String tagName); Map<String, T> getStringKeyedMapProperty(String tagName, Function<String, T> mapFunction); T getComplexType(String tagName, Class<T> targetClass);  }