diff --git a/pom.xml b/pom.xml index 8794d6e..a2491df 100644 --- a/pom.xml +++ b/pom.xml @@ -101,7 +101,6 @@ OF THE POSSIBILITY OF SUCH DAMAGE. xml-apis xml-apis - 2.0.2 provided @@ -113,7 +112,7 @@ OF THE POSSIBILITY OF SUCH DAMAGE. org.slf4j - slf4j-log4j12 + slf4j-reload4j 2.0.2 test @@ -162,10 +161,11 @@ OF THE POSSIBILITY OF SUCH DAMAGE. com.qulice qulice-maven-plugin - 0.21.1 + 0.22.0 xml:/src/it/settings.xml + pmd:/src/it/.* xml:/src/test/resources/com/jcabi/xml/.* findbugs:.* diff --git a/src/main/java/com/jcabi/xml/DomParser.java b/src/main/java/com/jcabi/xml/DomParser.java index b1f339b..2a55cdc 100644 --- a/src/main/java/com/jcabi/xml/DomParser.java +++ b/src/main/java/com/jcabi/xml/DomParser.java @@ -113,6 +113,7 @@ public Document document() { ex ); } + final long start = System.nanoTime(); final Document doc; try { doc = builder.parse(new ByteArrayInputStream(this.xml)); @@ -126,7 +127,13 @@ public Document document() { ); } if (Logger.isDebugEnabled(this)) { - Logger.debug(this, "%s parsed XML", builder.getClass().getName()); + Logger.debug( + this, + "%s parsed %d bytes of XML in %[nano]s", + builder.getClass().getName(), + this.xml.length, + System.nanoTime() - start + ); } return doc; } diff --git a/src/main/java/com/jcabi/xml/XMLDocument.java b/src/main/java/com/jcabi/xml/XMLDocument.java index a3ef373..e5b14d1 100644 --- a/src/main/java/com/jcabi/xml/XMLDocument.java +++ b/src/main/java/com/jcabi/xml/XMLDocument.java @@ -337,7 +337,7 @@ public int hashCode() { @Override public Node node() { - final Node casted = Node.class.cast(this.cache); + final Node casted = this.cache; final Node answer; if (casted instanceof Document) { answer = casted.cloneNode(true); @@ -362,7 +362,7 @@ public List xpath(final String query) { final NodeList nodes = this.fetch(query, NodeList.class); items = new ArrayList<>(nodes.getLength()); for (int idx = 0; idx < nodes.getLength(); ++idx) { - final int type = (int) nodes.item(idx).getNodeType(); + final int type = nodes.item(idx).getNodeType(); if (type != (int) Node.TEXT_NODE && type != (int) Node.ATTRIBUTE_NODE && type != (int) Node.CDATA_SECTION_NODE) { @@ -391,13 +391,13 @@ public List xpath(final String query) { ); } } - return new ListWrapper<>(items, Node.class.cast(this.cache), query); + return new ListWrapper<>(items, this.cache, query); } @Override public XML registerNs(final String prefix, final Object uri) { return new XMLDocument( - Node.class.cast(this.cache), + this.cache, this.context.add(prefix, uri), this.leaf ); @@ -425,13 +425,13 @@ public List nodes(final String query) { ), ex ); } - return new ListWrapper<>(items, Node.class.cast(this.cache), query); + return new ListWrapper<>(items, this.cache, query); } @Override public XML merge(final NamespaceContext ctx) { return new XMLDocument( - Node.class.cast(this.cache), + this.cache, this.context.merge(ctx), this.leaf ); @@ -496,7 +496,7 @@ private T fetch(final String query, final Class type) ) ); } - return (T) xpath.evaluate(query, Node.class.cast(this.cache), qname); + return (T) xpath.evaluate(query, this.cache, qname); } /** diff --git a/src/main/java/com/jcabi/xml/XSDDocument.java b/src/main/java/com/jcabi/xml/XSDDocument.java index 02ff3e9..b903338 100644 --- a/src/main/java/com/jcabi/xml/XSDDocument.java +++ b/src/main/java/com/jcabi/xml/XSDDocument.java @@ -184,14 +184,14 @@ public Collection validate(final Source xml) { } } catch (final SAXException ex) { throw new IllegalStateException( - String.format("failed to create XSD schema from %s", this.xsd), + String.format("Failed to create XSD schema from %s", this.xsd), ex ); } final Collection errors = new CopyOnWriteArrayList<>(); final Validator validator = schema.newValidator(); - validator.setErrorHandler(new ValidationHandler(errors)); + validator.setErrorHandler(new XSDDocument.ValidationHandler(errors)); try { synchronized (XSDDocument.class) { validator.validate(xml); diff --git a/src/main/java/com/jcabi/xml/XSLDocument.java b/src/main/java/com/jcabi/xml/XSLDocument.java index f1dc84d..d7855be 100644 --- a/src/main/java/com/jcabi/xml/XSLDocument.java +++ b/src/main/java/com/jcabi/xml/XSLDocument.java @@ -83,7 +83,7 @@ public final class XSLDocument implements XSL { * *

This will NOT remove * existing indentation between Element nodes currently introduced by the - * constructor of {@link com.jcabi.xml.XMLDocument}. For example: + * constructor of {@link XMLDocument}. For example: * *

      * {@code
@@ -403,6 +403,7 @@ private void transformInto(final XML xml, final Result result) {
         final Transformer trans = this.transformer();
         final ConsoleErrorListener errors = new ConsoleErrorListener();
         trans.setErrorListener(errors);
+        final long start = System.nanoTime();
         try {
             trans.transform(new DOMSource(xml.node()), result);
         } catch (final TransformerException ex) {
@@ -416,7 +417,12 @@ private void transformInto(final XML xml, final Result result) {
             );
         }
         if (Logger.isDebugEnabled(this)) {
-            Logger.debug(this, "%s transformed XML", trans.getClass().getName());
+            Logger.debug(
+                this,
+                "%s transformed XML in %[nano]s",
+                trans.getClass().getName(),
+                System.nanoTime() - start
+            );
         }
     }
 
@@ -464,12 +470,12 @@ private static Transformer forSaxon(final Transformer trans) {
             return trans;
         }
         if (Version.getStructuredVersionNumber()[0] < 11) {
-            TransformerImpl.class.cast(trans)
+            ((TransformerImpl) trans)
                 .getUnderlyingController()
                 .setMessageEmitter(new MessageWarner());
         }
         if (Version.getStructuredVersionNumber()[0] >= 11) {
-            TransformerImpl.class.cast(trans)
+            ((TransformerImpl) trans)
                 .getUnderlyingController()
                 .setMessageHandler(
                     message -> Logger.error(
diff --git a/src/test/java/com/jcabi/xml/ClasspathInputTest.java b/src/test/java/com/jcabi/xml/ClasspathInputTest.java
index 7d91207..4c520d0 100644
--- a/src/test/java/com/jcabi/xml/ClasspathInputTest.java
+++ b/src/test/java/com/jcabi/xml/ClasspathInputTest.java
@@ -35,12 +35,12 @@
 import org.w3c.dom.ls.LSInput;
 
 /**
- * Test case for {@link com.jcabi.xml.ClasspathInput}.
+ * Test case for {@link ClasspathInput}.
  * @since 0.17.3
  */
-public final class ClasspathInputTest {
+final class ClasspathInputTest {
     @Test
-    public void readsStringFromResourceSuccessfully() {
+    void readsStringFromResourceSuccessfully() {
         final LSInput input = new ClasspathInput(
             "Id", "com/jcabi/xml/simple.xml"
         );
diff --git a/src/test/java/com/jcabi/xml/ClasspathSourcesTest.java b/src/test/java/com/jcabi/xml/ClasspathSourcesTest.java
index cb28f1c..84f40bd 100644
--- a/src/test/java/com/jcabi/xml/ClasspathSourcesTest.java
+++ b/src/test/java/com/jcabi/xml/ClasspathSourcesTest.java
@@ -37,10 +37,10 @@
  * Test of ClasspathSources.
  * @since 0.18
  */
-public final class ClasspathSourcesTest {
+final class ClasspathSourcesTest {
 
     @Test
-    public void sourcesResolvedFromBase() throws Exception {
+    void sourcesResolvedFromBase() throws Exception {
         MatcherAssert.assertThat(
             new ClasspathSources().resolve("simple.xml", "com.jcabi.xml."),
             Matchers.notNullValue()
diff --git a/src/test/java/com/jcabi/xml/DomParserTest.java b/src/test/java/com/jcabi/xml/DomParserTest.java
index e5f4f7e..23cb21a 100644
--- a/src/test/java/com/jcabi/xml/DomParserTest.java
+++ b/src/test/java/com/jcabi/xml/DomParserTest.java
@@ -38,10 +38,10 @@
  * Test case for {@link DomParser}.
  * @since 0.1
  */
-public final class DomParserTest {
+final class DomParserTest {
 
     @Test
-    public void parsesIncomingXmlDocument() {
+    void parsesIncomingXmlDocument() {
         final String xml = "\u0443\u0440\u0430!";
         final DomParser parser = new DomParser(
             DocumentBuilderFactory.newInstance(), xml
@@ -53,7 +53,7 @@ public void parsesIncomingXmlDocument() {
     }
 
     @Test
-    public void parsesIncomingXmlDocumentComment() {
+    void parsesIncomingXmlDocumentComment() {
         final String xml = "";
         final DomParser parser = new DomParser(
             DocumentBuilderFactory.newInstance(), xml
@@ -66,8 +66,8 @@ public void parsesIncomingXmlDocumentComment() {
 
     @Test
     @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
-    public void allowsValidXmlFormatting() {
-        final String[] texts = new String[] {
+    void allowsValidXmlFormatting() {
+        final String[] texts = {
             "",
             "<:a/>",
             "",
diff --git a/src/test/java/com/jcabi/xml/FileSourcesTest.java b/src/test/java/com/jcabi/xml/FileSourcesTest.java
index 56b9c38..243d9e7 100644
--- a/src/test/java/com/jcabi/xml/FileSourcesTest.java
+++ b/src/test/java/com/jcabi/xml/FileSourcesTest.java
@@ -41,10 +41,10 @@
  * Test of FileSources.
  * @since 0.18
  */
-public final class FileSourcesTest {
+final class FileSourcesTest {
 
     @Test
-    public void sourcesResolvedFromDir() throws Exception {
+    void sourcesResolvedFromDir() throws Exception {
         final File file = Files.createTempDirectory("")
             .resolve("dummy.xml").toFile();
         new LengthOf(new TeeInput("test", file)).value();
diff --git a/src/test/java/com/jcabi/xml/StrictXMLTest.java b/src/test/java/com/jcabi/xml/StrictXMLTest.java
index 4ae49ec..d59c11f 100755
--- a/src/test/java/com/jcabi/xml/StrictXMLTest.java
+++ b/src/test/java/com/jcabi/xml/StrictXMLTest.java
@@ -50,6 +50,7 @@
 import org.junit.jupiter.api.Assumptions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
+import org.mockito.ArgumentMatchers;
 import org.mockito.Mockito;
 import org.mockito.stubbing.Answer;
 
@@ -61,17 +62,17 @@
  * @checkstyle AbbreviationAsWordInNameCheck (5 lines)
  */
 @SuppressWarnings({ "PMD.TooManyMethods", "PMD.AvoidDuplicateLiterals"})
-public final class StrictXMLTest {
+final class StrictXMLTest {
 
     @BeforeEach
-    public void weAreOnline() throws IOException {
+    void weAreOnline() throws IOException {
         Assumptions.assumeTrue(
             InetAddress.getByName("w3.org").isReachable(1000)
         );
     }
 
     @Test
-    public void passesValidXmlThrough() {
+    void passesValidXmlThrough() {
         new StrictXML(
             new XMLDocument("passesValidXmlThrough"),
             new XSDDocument(
@@ -85,7 +86,7 @@ public void passesValidXmlThrough() {
     }
 
     @Test
-    public void rejectsInvalidXmlThrough() {
+    void rejectsInvalidXmlThrough() {
         Assertions.assertThrows(
             IllegalArgumentException.class,
             () -> new StrictXML(
@@ -101,7 +102,7 @@ public void rejectsInvalidXmlThrough() {
     }
 
     @Test
-    public void passesValidXmlUsingXsiSchemaLocation() throws Exception {
+    void passesValidXmlUsingXsiSchemaLocation() throws Exception {
         new StrictXML(
             new XMLDocument(
                 this.getClass().getResource("xsi-schemalocation-valid.xml")
@@ -110,7 +111,7 @@ public void passesValidXmlUsingXsiSchemaLocation() throws Exception {
     }
 
     @Test
-    public void rejectsInvalidXmlUsingXsiSchemaLocation() {
+    void rejectsInvalidXmlUsingXsiSchemaLocation() {
         Assertions.assertThrows(
             IllegalStateException.class,
             () -> new StrictXML(
@@ -122,7 +123,7 @@ public void rejectsInvalidXmlUsingXsiSchemaLocation() {
     }
 
     @Test
-    public void validatesMultipleXmlsInThreads() throws Exception {
+    void validatesMultipleXmlsInThreads() throws Exception {
         final int timeout = 10;
         final int numrun = 100;
         final int loop = 50;
@@ -176,7 +177,7 @@ public void validatesMultipleXmlsInThreads() throws Exception {
     }
 
     @Test
-    public void passesValidXmlWithNetworkProblems() throws Exception {
+    void passesValidXmlWithNetworkProblems() throws Exception {
         final Validator validator = Mockito.mock(Validator.class);
         final AtomicInteger counter = new AtomicInteger(0);
         // @checkstyle IllegalThrowsCheck (5 lines)
@@ -190,7 +191,7 @@ public void passesValidXmlWithNetworkProblems() throws Exception {
                 }
                 return null;
             }
-        ).when(validator).validate(Mockito.any(Source.class));
+        ).when(validator).validate(ArgumentMatchers.any(Source.class));
         new StrictXML(
             new XMLDocument(
                 "passesValidXmlWithNetworkProblems"
@@ -200,7 +201,7 @@ public void passesValidXmlWithNetworkProblems() throws Exception {
     }
 
     @Test
-    public void lookupXsdsFromClasspath() {
+    void lookupXsdsFromClasspath() {
         new StrictXML(
             new XMLDocument(
                 StringUtils.join(
@@ -224,7 +225,7 @@ public void lookupXsdsFromClasspath() {
     }
 
     @Test
-    public void rejectXmlWhenXsdIsNotAvailableOnClasspath() {
+    void rejectXmlWhenXsdIsNotAvailableOnClasspath() {
         Assertions.assertThrows(
             IllegalArgumentException.class,
             () -> new StrictXML(
@@ -251,7 +252,7 @@ public void rejectXmlWhenXsdIsNotAvailableOnClasspath() {
     }
 
     @Test
-    public void handlesXmlWithoutSchemaLocation() {
+    void handlesXmlWithoutSchemaLocation() {
         Assertions.assertThrows(
             IllegalArgumentException.class,
             () -> new StrictXML(
diff --git a/src/test/java/com/jcabi/xml/TextResourceTest.java b/src/test/java/com/jcabi/xml/TextResourceTest.java
index d986f52..5359229 100644
--- a/src/test/java/com/jcabi/xml/TextResourceTest.java
+++ b/src/test/java/com/jcabi/xml/TextResourceTest.java
@@ -45,10 +45,10 @@
  *
  * @since 0.1
  */
-public final class TextResourceTest {
+final class TextResourceTest {
 
     @Test
-    public void readsStreamAsText() {
+    void readsStreamAsText() {
         final String text = "Blah!\u20ac\u2122";
         final InputStream stream = new ByteArrayInputStream(
             text.getBytes(StandardCharsets.UTF_8)
@@ -60,7 +60,7 @@ public void readsStreamAsText() {
     }
 
     @Test
-    public void readsFileAsText() throws Exception {
+    void readsFileAsText() throws Exception {
         final String text = "\u0433!";
         final File file = Files.createTempDirectory("")
             .resolve("dummy.xml").toFile();
diff --git a/src/test/java/com/jcabi/xml/XMLDocumentTest.java b/src/test/java/com/jcabi/xml/XMLDocumentTest.java
index a76502f..d2f916f 100644
--- a/src/test/java/com/jcabi/xml/XMLDocumentTest.java
+++ b/src/test/java/com/jcabi/xml/XMLDocumentTest.java
@@ -56,10 +56,10 @@
  * @checkstyle AbbreviationAsWordInNameCheck (5 lines)
  */
 @SuppressWarnings({ "PMD.TooManyMethods", "PMD.DoNotUseThreads" })
-public final class XMLDocumentTest {
+final class XMLDocumentTest {
 
     @Test
-    public void findsDocumentNodesWithXpath() {
+    void findsDocumentNodesWithXpath() {
         final XML doc = new XMLDocument(
             "\u0443\u0440\u0430!B"
         );
@@ -74,7 +74,7 @@ public void findsDocumentNodesWithXpath() {
     }
 
     @Test
-    public void findWithXpathListEqualsToJavaUtilList() {
+    void findWithXpathListEqualsToJavaUtilList() {
         MatcherAssert.assertThat(
             new XMLDocument(
                 ""
@@ -102,7 +102,7 @@ public void findWithXpathListEqualsToJavaUtilList() {
     }
 
     @Test
-    public void findsWithXpathAndNamespaces() {
+    void findsWithXpathAndNamespaces() {
         final XML doc = new XMLDocument(
             "
\u0443\u0440\u0430!
" ); @@ -117,7 +117,7 @@ public void findsWithXpathAndNamespaces() { } @Test - public void findsWithXpathWithCustomNamespace() throws Exception { + void findsWithXpathWithCustomNamespace() throws Exception { final File file = Files.createTempDirectory("") .resolve("x.xml").toFile(); new LengthOf( @@ -138,7 +138,7 @@ public void findsWithXpathWithCustomNamespace() throws Exception { } @Test - public void findsDocumentNodesWithXpathAndReturnsThem() throws Exception { + void findsDocumentNodesWithXpathAndReturnsThem() throws Exception { final XML doc = new XMLDocument( new ByteArrayInputStream( "12".getBytes() @@ -155,7 +155,7 @@ public void findsDocumentNodesWithXpathAndReturnsThem() throws Exception { } @Test - public void convertsItselfToXml() { + void convertsItselfToXml() { final XML doc = new XMLDocument(""); MatcherAssert.assertThat( doc.toString(), @@ -164,7 +164,7 @@ public void convertsItselfToXml() { } @Test - public void retrievesDomNode() throws Exception { + void retrievesDomNode() throws Exception { final XML doc = new XMLDocument( this.getClass().getResource("simple.xml") ); @@ -179,7 +179,7 @@ public void retrievesDomNode() throws Exception { } @Test - public void throwsCustomExceptionWhenXpathNotFound() { + void throwsCustomExceptionWhenXpathNotFound() { try { new XMLDocument("").xpath("/absent-node/text()").get(0); MatcherAssert.assertThat("exception expected here", false); @@ -195,7 +195,7 @@ public void throwsCustomExceptionWhenXpathNotFound() { } @Test - public void throwsWhenXpathQueryIsBroken() { + void throwsWhenXpathQueryIsBroken() { try { new XMLDocument("").xpath("/*/hello()"); MatcherAssert.assertThat("exception expected", false); @@ -208,7 +208,7 @@ public void throwsWhenXpathQueryIsBroken() { } @Test - public void preservesProcessingInstructions() { + void preservesProcessingInstructions() { MatcherAssert.assertThat( new XMLDocument(""), Matchers.hasToString(Matchers.containsString("")) @@ -216,7 +216,7 @@ public void preservesProcessingInstructions() { } @Test - public void preservesDomStructureWhenXpath() { + void preservesDomStructureWhenXpath() { final XML doc = new XMLDocument( "" ); @@ -228,7 +228,7 @@ public void preservesDomStructureWhenXpath() { } @Test - public void printsWithAndWithoutXmlHeader() { + void printsWithAndWithoutXmlHeader() { final XML doc = new XMLDocument(""); MatcherAssert.assertThat( doc, @@ -241,7 +241,7 @@ public void printsWithAndWithoutXmlHeader() { } @Test - public void parsesInMultipleThreads() throws Exception { + void parsesInMultipleThreads() throws Exception { final int timeout = 10; final int loop = 100; final Runnable runnable = () -> MatcherAssert.assertThat( @@ -249,7 +249,7 @@ public void parsesInMultipleThreads() throws Exception { XhtmlMatchers.hasXPath("/root/hey") ); final ExecutorService service = Executors.newFixedThreadPool(5); - for (int count = 0; count < loop; count = count + 1) { + for (int count = 0; count < loop; count += 1) { service.submit(runnable); } service.shutdown(); @@ -261,7 +261,7 @@ public void parsesInMultipleThreads() throws Exception { } @Test - public void xpathInMultipleThreads() throws Exception { + void xpathInMultipleThreads() throws Exception { final int timeout = 30; final int repeat = 1000; final int loop = 50; @@ -297,7 +297,7 @@ public void xpathInMultipleThreads() throws Exception { } @Test - public void printsInMultipleThreads() throws Exception { + void printsInMultipleThreads() throws Exception { final int timeout = 30; final int repeat = 1000; final int loop = 50; @@ -327,7 +327,7 @@ public void printsInMultipleThreads() throws Exception { } @Test - public void performsXpathCalculations() { + void performsXpathCalculations() { final XML xml = new XMLDocument(""); MatcherAssert.assertThat( xml.xpath("count(//x/a)"), @@ -340,7 +340,7 @@ public void performsXpathCalculations() { } @Test - public void buildsDomNode() { + void buildsDomNode() { final XML doc = new XMLDocument(""); MatcherAssert.assertThat( doc.node(), @@ -353,7 +353,7 @@ public void buildsDomNode() { } @Test - public void comparesToAnotherDocument() { + void comparesToAnotherDocument() { MatcherAssert.assertThat( new XMLDocument("\n "), Matchers.equalTo(new XMLDocument(" ")) @@ -367,7 +367,7 @@ public void comparesToAnotherDocument() { } @Test - public void preservesXmlNamespaces() { + void preservesXmlNamespaces() { final String xml = ""; MatcherAssert.assertThat( new XMLDocument(xml), @@ -376,7 +376,7 @@ public void preservesXmlNamespaces() { } @Test - public void preservesImmutability() { + void preservesImmutability() { final XML xml = new XMLDocument(""); final Node node = xml.nodes("/r1/a").get(0).node(); node.appendChild(node.getOwnerDocument().createElement("h9")); @@ -387,7 +387,7 @@ public void preservesImmutability() { } @Test - public void appliesXpathToClonedNode() { + void appliesXpathToClonedNode() { final XML xml = new XMLDocument(""); final XML root = xml.nodes("/t6").get(0); MatcherAssert.assertThat( diff --git a/src/test/java/com/jcabi/xml/XPathContextTest.java b/src/test/java/com/jcabi/xml/XPathContextTest.java index 059d901..88861e2 100644 --- a/src/test/java/com/jcabi/xml/XPathContextTest.java +++ b/src/test/java/com/jcabi/xml/XPathContextTest.java @@ -42,10 +42,10 @@ * Test case for {@link XPathContext}. * @since 0.1 */ -public final class XPathContextTest { +final class XPathContextTest { @Test - public void findsNamespaceByPrefix() { + void findsNamespaceByPrefix() { final String prefix = "ns1-foo"; final String namespace = "hey-it-is-a-namespace"; final NamespaceContext ctx = new XPathContext() @@ -58,7 +58,7 @@ public void findsNamespaceByPrefix() { } @Test - public void findsPrefixByNamespace() { + void findsPrefixByNamespace() { final String prefix = "ns2-foo"; final String namespace = "hey-it-is-a-new-namespace"; final NamespaceContext ctx = new XPathContext() @@ -71,13 +71,13 @@ public void findsPrefixByNamespace() { } @Test - public void findsPrefixesByNamespace() { + void findsPrefixesByNamespace() { final String namespace = "simple-short-namespace"; final NamespaceContext ctx = new XPathContext(namespace, namespace); final List prefixes = new ArrayList<>(0); final Iterator iter = ctx.getPrefixes(namespace); while (iter.hasNext()) { - prefixes.add(String.class.cast(iter.next())); + prefixes.add((String) iter.next()); } MatcherAssert.assertThat( prefixes, @@ -90,7 +90,7 @@ public void findsPrefixesByNamespace() { } @Test - public void findsDefaultNamespaces() { + void findsDefaultNamespaces() { final NamespaceContext ctx = new XPathContext(); MatcherAssert.assertThat( ctx.getNamespaceURI("xhtml"), @@ -119,7 +119,7 @@ public void findsDefaultNamespaces() { } @Test - public void findsNonBoundNamespaces() { + void findsNonBoundNamespaces() { final NamespaceContext ctx = new XPathContext(); MatcherAssert.assertThat( ctx.getNamespaceURI("some-other-unbound-prefix"), diff --git a/src/test/java/com/jcabi/xml/XSDDocumentTest.java b/src/test/java/com/jcabi/xml/XSDDocumentTest.java index 9a3ea2e..680ca78 100644 --- a/src/test/java/com/jcabi/xml/XSDDocumentTest.java +++ b/src/test/java/com/jcabi/xml/XSDDocumentTest.java @@ -52,10 +52,10 @@ * @since 0.1 * @checkstyle AbbreviationAsWordInNameCheck (5 lines) */ -public final class XSDDocumentTest { +final class XSDDocumentTest { @Test - public void validatesXml() { + void validatesXml() { final XSD xsd = new XSDDocument( new ByteArrayInputStream( StringUtils.join( @@ -78,7 +78,7 @@ public void validatesXml() { } @Test - public void detectsSchemaViolations() { + void detectsSchemaViolations() { final String xsd = StringUtils.join( "", "" @@ -99,16 +99,12 @@ public void detectsSchemaViolations() { ); } - /** - * XSDDocument can validate complex XML. - * @throws Exception If something goes wrong inside - */ @Test @SuppressWarnings({ "PMD.AvoidInstantiatingObjectsInLoops", "PMD.InsufficientStringBufferDeclaration" }) - public void validatesComplexXml() throws Exception { + void validatesComplexXml() throws Exception { final int loopp = 5; final int size = 10_000; final int loop = 100; @@ -143,12 +139,8 @@ public void validatesComplexXml() throws Exception { } } - /** - * XSDDocument can validate a long XML. - * @throws Exception If something goes wrong inside - */ @Test - public void validatesLongXml() throws Exception { + void validatesLongXml() throws Exception { final XSD xsd = new XSDDocument( this.getClass().getResource("sample.xsd") ); @@ -171,12 +163,8 @@ public void validatesLongXml() throws Exception { ); } - /** - * XSDDocument can validate XML in multiple threads. - * @throws Exception If something goes wrong inside - */ @Test - public void validatesMultipleXmlsInThreads() throws Exception { + void validatesMultipleXmlsInThreads() throws Exception { final int random = 100; final int loop = 10; final int timeout = 30; @@ -220,7 +208,7 @@ public Void call() throws Exception { } service.shutdown(); MatcherAssert.assertThat( - service.awaitTermination((long) timeout, TimeUnit.SECONDS), + service.awaitTermination(timeout, TimeUnit.SECONDS), Matchers.is(true) ); service.shutdownNow(); diff --git a/src/test/java/com/jcabi/xml/XSLChainTest.java b/src/test/java/com/jcabi/xml/XSLChainTest.java index d697660..02cd48f 100644 --- a/src/test/java/com/jcabi/xml/XSLChainTest.java +++ b/src/test/java/com/jcabi/xml/XSLChainTest.java @@ -40,10 +40,10 @@ * @since 0.12 * @checkstyle AbbreviationAsWordInNameCheck (5 lines) */ -public final class XSLChainTest { +final class XSLChainTest { @Test - public void makesXslTransformations() { + void makesXslTransformations() { final XSL first = new XSLDocument( StringUtils.join( " ") @@ -147,7 +147,7 @@ public void stripsXml() { } @Test - public void transformsIntoTextWithParams() { + void transformsIntoTextWithParams() { final XSL xsl = new XSLDocument( StringUtils.join( "