From 2a47c185c6b23df472b50130d0c3111dfc0d0ba9 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Mon, 17 Jun 2024 21:37:36 +0000 Subject: [PATCH] issue with Java 22 returning string values insteadof booleans git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1918397 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/util/TestXMLHelper.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/poi/src/test/java/org/apache/poi/util/TestXMLHelper.java b/poi/src/test/java/org/apache/poi/util/TestXMLHelper.java index 3dec9056e5..f291aea270 100644 --- a/poi/src/test/java/org/apache/poi/util/TestXMLHelper.java +++ b/poi/src/test/java/org/apache/poi/util/TestXMLHelper.java @@ -36,6 +36,7 @@ import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLOutputFactory; +import org.junit.jupiter.api.Assumptions; import org.junit.jupiter.api.Test; import org.xml.sax.InputSource; import org.xml.sax.SAXNotRecognizedException; @@ -136,12 +137,12 @@ class TestXMLHelper { @Test void testNewXMLInputFactory() { XMLInputFactory factory = XMLHelper.newXMLInputFactory(); - if (!System.getProperty("java.version").startsWith("22")) { - assertEquals(Boolean.TRUE, factory.getProperty(XMLInputFactory.IS_NAMESPACE_AWARE)); - assertEquals(Boolean.FALSE, factory.getProperty(XMLInputFactory.IS_VALIDATING)); - assertEquals(Boolean.FALSE, factory.getProperty(XMLInputFactory.SUPPORT_DTD)); - assertEquals(Boolean.FALSE, factory.getProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES)); - } + Assumptions.assumeFalse(System.getProperty("java.version").startsWith("22"), + "test ignored for Java 22"); + assertEquals(Boolean.TRUE, factory.getProperty(XMLInputFactory.IS_NAMESPACE_AWARE)); + assertEquals(Boolean.FALSE, factory.getProperty(XMLInputFactory.IS_VALIDATING)); + assertEquals(Boolean.FALSE, factory.getProperty(XMLInputFactory.SUPPORT_DTD)); + assertEquals(Boolean.FALSE, factory.getProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES)); } /** @@ -150,9 +151,9 @@ class TestXMLHelper { @Test void testNewXMLOutputFactory() { XMLOutputFactory factory = XMLHelper.newXMLOutputFactory(); - if (!System.getProperty("java.version").startsWith("22")) { - assertEquals(Boolean.TRUE, factory.getProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES)); - } + Assumptions.assumeFalse(System.getProperty("java.version").startsWith("22"), + "test ignored for Java 22"); + assertEquals(Boolean.TRUE, factory.getProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES)); } /** -- 2.39.5