diff --git a/pom.xml b/pom.xml index 44f05351..5349567c 100644 --- a/pom.xml +++ b/pom.xml @@ -54,7 +54,7 @@ https://sonarcloud.io xlate - 2.3.2 + 2.3.3 @@ -63,7 +63,7 @@ org.apache.maven.plugins maven-dependency-plugin - 3.1.1 + 3.1.2 org.apache.maven.plugins @@ -176,42 +176,42 @@ org.junit.jupiter junit-jupiter-api - 5.5.2 + 5.6.2 org.junit.jupiter junit-jupiter-engine - 5.5.2 + 5.6.2 org.junit.platform junit-platform-runner - 1.5.2 + 1.6.2 org.mockito mockito-junit-jupiter - 3.2.4 + 3.3.3 org.mockito mockito-core - 3.0.0 + 3.3.3 org.glassfish.jaxb jaxb-runtime - 2.3.2 + 2.3.3 org.xmlunit xmlunit-core - 2.6.3 + 2.7.0 org.xmlunit xmlunit-matchers - 2.6.3 + 2.7.0 diff --git a/src/main/java9/module-info.java b/src/main/java9/module-info.java index 5c94c435..1e4a6f81 100644 --- a/src/main/java9/module-info.java +++ b/src/main/java9/module-info.java @@ -1,6 +1,5 @@ module io.xlate.staedi { requires java.base; - requires java.desktop; requires java.logging; requires transitive java.xml; diff --git a/src/test/java/io/xlate/edi/internal/bind/TransactionBindTest.java b/src/test/java/io/xlate/edi/internal/bind/TransactionBindTest.java index 791dd5c0..3987c7ed 100644 --- a/src/test/java/io/xlate/edi/internal/bind/TransactionBindTest.java +++ b/src/test/java/io/xlate/edi/internal/bind/TransactionBindTest.java @@ -2,7 +2,6 @@ import static org.junit.jupiter.api.Assertions.fail; -import java.beans.Introspector; import java.io.IOException; import java.io.StringWriter; import java.lang.annotation.Annotation; @@ -101,7 +100,7 @@ QName getRootElementName(Class type) { if (rootElement != null) { if ("##default".equals(rootElement.name())) { - localName = Introspector.decapitalize(type.getSimpleName()); + localName = decapitalize(type.getSimpleName()); } else { localName = rootElement.name(); } @@ -117,6 +116,34 @@ QName getRootElementName(Class type) { throw new IllegalStateException("Missing XmlRootElement annotation on root class"); } + /** + * Utility method to take a string and convert it to normal Java variable + * name capitalization. This normally means converting the first + * character from upper case to lower case, but in the (unusual) special + * case when there is more than one character and both the first and + * second characters are upper case, we leave it alone. + *

+ * Thus "FooBah" becomes "fooBah" and "X" becomes "x", but "URL" stays + * as "URL". + * + * COPYIED FROM java.beans.Introspector + * + * @param name The string to be decapitalized. + * @return The decapitalized version of the string. + */ + static String decapitalize(String name) { + if (name == null || name.length() == 0) { + return name; + } + if (name.length() > 1 && Character.isUpperCase(name.charAt(1)) && + Character.isUpperCase(name.charAt(0))){ + return name; + } + char chars[] = name.toCharArray(); + chars[0] = Character.toLowerCase(chars[0]); + return new String(chars); + } + Stream elementStream(NodeList nodes) { return IntStream.range(0, nodes.getLength()).mapToObj(nodes::item).map(Element.class::cast); } diff --git a/src/test/java/io/xlate/edi/internal/schema/StaEDISchemaFactoryTest.java b/src/test/java/io/xlate/edi/internal/schema/StaEDISchemaFactoryTest.java index 8b273d89..7795f932 100644 --- a/src/test/java/io/xlate/edi/internal/schema/StaEDISchemaFactoryTest.java +++ b/src/test/java/io/xlate/edi/internal/schema/StaEDISchemaFactoryTest.java @@ -471,7 +471,7 @@ void testAnyElementType() throws EDISchemaException { } @Test - void testAnySegmentTypeInvalid() throws EDISchemaException { + void testAnySegmentTypeInvalid() { SchemaFactory factory = SchemaFactory.newFactory(); InputStream stream = new ByteArrayInputStream(("" + ""