[java-shib-shared] branch main updated: Remove null-violating tests and tighten up the settings again.
Scott Cantor
cantor.2 at osu.edu
Tue Nov 22 13:49:44 UTC 2022
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch main
in repository java-shib-shared.
View the commit online:
http://git.shibboleth.net/view/?p=java-shib-shared.git;a=commit;h=49403436297682c182b717c777c227b8d27096a2
The following commit(s) were added to refs/heads/main by this push:
new 49403436 Remove null-violating tests and tighten up the settings again.
49403436 is described below
commit 49403436297682c182b717c777c227b8d27096a2
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Nov 22 08:49:41 2022 -0500
Remove null-violating tests and tighten up the settings again.
---
.../shibboleth/shared/primitive/StringSupport.java | 4 +-
.../shibboleth/shared/codec/Base32SupportTest.java | 12 -
.../shibboleth/shared/codec/Base64SupportTest.java | 27 +-
.../shared/primitive/StringSupportTest.java | 31 ++-
.../shared/scripting/EvaluableScriptTest.java | 10 +-
.../shared/xml/AttributeSupportTest.java | 295 +++++++++++----------
.../shibboleth/shared/xml/DOMTypeSupportTest.java | 1 +
.../shibboleth/shared/xml/ElementSupportTest.java | 5 +-
.../shared/xml/NamespaceSupportTest.java | 1 +
.../shibboleth/shared/xml/QNameSupportTest.java | 3 +
.../shibboleth/shared/xml/SchemaBuilderTest.java | 1 +
.../shared/xml/SerializeSupportTest.java | 1 +
.../net/shibboleth/shared/xml/XMLSpaceTest.java | 1 +
13 files changed, 208 insertions(+), 184 deletions(-)
diff --git a/shib-support/src/main/java/net/shibboleth/shared/primitive/StringSupport.java b/shib-support/src/main/java/net/shibboleth/shared/primitive/StringSupport.java
index a854584a..77076bdd 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/primitive/StringSupport.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/primitive/StringSupport.java
@@ -183,11 +183,12 @@ public final class StringSupport {
* @param what the string: potentially empty or null
* @return null or the boolean equivalent.
*/
- @Nullable public static Boolean booleanOf(final String what) {
+ @Nullable public static Boolean booleanOf(@Nullable final String what) {
final String trimmed = trimOrNull(what);
if (trimmed == null) {
return null;
}
+
if ("1".equals(what)) {
return true;
} else if ("0".equals(what)) {
@@ -197,6 +198,7 @@ public final class StringSupport {
} else if ("false".equals(what)) {
return false;
}
+
throw new ConstraintViolationException("XML Booleans must be 0/1/true/false");
}
}
diff --git a/shib-support/src/test/java/net/shibboleth/shared/codec/Base32SupportTest.java b/shib-support/src/test/java/net/shibboleth/shared/codec/Base32SupportTest.java
index 4138be86..10968660 100644
--- a/shib-support/src/test/java/net/shibboleth/shared/codec/Base32SupportTest.java
+++ b/shib-support/src/test/java/net/shibboleth/shared/codec/Base32SupportTest.java
@@ -20,8 +20,6 @@ package net.shibboleth.shared.codec;
import org.testng.Assert;
import org.testng.annotations.Test;
-import net.shibboleth.shared.logic.ConstraintViolationException;
-
/** {@link Base32Support} unit test. */
public class Base32SupportTest {
@@ -64,16 +62,6 @@ public class Base32SupportTest {
}
- /**
- * Test a null byte array argument violates the method contract and throws a {@link ConstraintViolationException}.
- *
- * @throws EncodingException on encoding failure.
- */
- @Test(expectedExceptions = ConstraintViolationException.class) public void testEncodeNullInput()
- throws EncodingException {
- Base32Support.encode(null, false);
- }
-
/**
* Test encoding a byte array works.
*
diff --git a/shib-support/src/test/java/net/shibboleth/shared/codec/Base64SupportTest.java b/shib-support/src/test/java/net/shibboleth/shared/codec/Base64SupportTest.java
index 91c4ed1a..e5b0107e 100644
--- a/shib-support/src/test/java/net/shibboleth/shared/codec/Base64SupportTest.java
+++ b/shib-support/src/test/java/net/shibboleth/shared/codec/Base64SupportTest.java
@@ -69,7 +69,11 @@ public class Base64SupportTest {
/** Empty string.*/
private final static String EMPTY_STRING = "";
-
+ /**
+ * Set up tests.
+ *
+ * @throws DecoderException
+ */
@BeforeClass
public void setUp() throws DecoderException {
PLAIN_BYTES = Hex.decodeHex("14fb9c03d97e".toCharArray());
@@ -95,26 +99,6 @@ public class Base64SupportTest {
Assert.assertNotNull(encoded);
Assert.assertEquals(encoded, EMPTY_STRING);
}
-
- /**
- * Test a null byte array argument violates the method contract and throws a {@link ConstraintViolationException}.
- *
- * @throws EncodingException on encoding failure.
- */
- @Test(expectedExceptions = ConstraintViolationException.class) public void testEncodeNullInput()
- throws EncodingException {
- Base64Support.encode(null,false);
- }
-
- /**
- * Test a null string argument violates the method contract and throws a {@link ConstraintViolationException}.
- *
- * @throws DecodingException on decoding failure.
- */
- @Test(expectedExceptions = ConstraintViolationException.class) public void testDecodeNullInput()
- throws DecodingException {
- Base64Support.decode(null);
- }
/** Test Base64 decoding content.
*
@@ -179,4 +163,5 @@ public class Base64SupportTest {
Assert.assertEquals(new String(Base64Support.decodeURLSafe(URLSAFE_UNCHUNCKED_ENCODED_TEXT)), PLAIN_TEXT);
Assert.assertEquals(Base64Support.decodeURLSafe(URLSAFE_UNCHUNCKED_ENCODED_BYTES), PLAIN_BYTES);
}
+
}
\ No newline at end of file
diff --git a/shib-support/src/test/java/net/shibboleth/shared/primitive/StringSupportTest.java b/shib-support/src/test/java/net/shibboleth/shared/primitive/StringSupportTest.java
index 8ef1eac3..a1400408 100644
--- a/shib-support/src/test/java/net/shibboleth/shared/primitive/StringSupportTest.java
+++ b/shib-support/src/test/java/net/shibboleth/shared/primitive/StringSupportTest.java
@@ -33,6 +33,7 @@ import java.util.List;
import javax.annotation.Nonnull;
+import org.testng.Assert;
import org.testng.annotations.Test;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
@@ -41,6 +42,7 @@ import net.shibboleth.shared.logic.ConstraintViolationException;
/**
* test for the various methods inside {@link StringSupport}
*/
+ at SuppressWarnings("javadoc")
public class StringSupportTest {
@Nonnull @NotEmpty private static final String TRIM_TEST1 = " AARDVARK incorporated";
@@ -110,8 +112,9 @@ public class StringSupportTest {
@Test public void testTrim() {
assertEquals(StringSupport.trim(null), null, "Trimming Null should be OK");
- assertEquals(StringSupport.trim(EMPTY_TRIM_TEST2).length(), 0,
- "Trimming an empty string should return a string of zero length");
+ final String trimmed = StringSupport.trim(EMPTY_TRIM_TEST2);
+ assert trimmed != null;
+ assertEquals(trimmed.length(), 0, "Trimming an empty string should return a string of zero length");
assertEquals(StringSupport.trim(TRIM_TEST1), TRIM_TEST1.trim(), "Trimming a string");
@@ -161,16 +164,30 @@ public class StringSupportTest {
assertFalse(Boolean.valueOf(""));
assertNull(StringSupport.booleanOf(null));
assertFalse(Boolean.valueOf(null));
- assertTrue(StringSupport.booleanOf("true"));
+
+ Boolean flag = StringSupport.booleanOf("true");
+ assert flag != null;
+ assertTrue(flag);
+
assertTrue(Boolean.valueOf("true"));
- assertFalse(StringSupport.booleanOf("false"));
+
+ flag = StringSupport.booleanOf("false");
+ assert flag != null;
+ assertFalse(flag);
assertFalse(Boolean.valueOf("false"));
- assertFalse(StringSupport.booleanOf("0"));
- assertTrue(StringSupport.booleanOf("1"));
+
+ flag = StringSupport.booleanOf("0");
+ assert flag != null;
+ assertFalse(flag);
+
+ flag = StringSupport.booleanOf("1");
+ assert flag != null;
+ assertTrue(flag);
+
try {
StringSupport.booleanOf("elephant");
fail("Should have thrown");
- } catch (ConstraintViolationException e) {
+ } catch (final ConstraintViolationException e) {
// OK
}
}
diff --git a/shib-support/src/test/java/net/shibboleth/shared/scripting/EvaluableScriptTest.java b/shib-support/src/test/java/net/shibboleth/shared/scripting/EvaluableScriptTest.java
index 24989f10..b205bf87 100644
--- a/shib-support/src/test/java/net/shibboleth/shared/scripting/EvaluableScriptTest.java
+++ b/shib-support/src/test/java/net/shibboleth/shared/scripting/EvaluableScriptTest.java
@@ -167,11 +167,11 @@ public class EvaluableScriptTest {
}
public URL getURL() throws IOException {
- return null;
+ throw new IOException();
}
public URI getURI() throws IOException {
- return null;
+ throw new IOException();
}
public InputStream getInputStream() throws IOException {
@@ -183,11 +183,11 @@ public class EvaluableScriptTest {
}
public File getFile() throws IOException {
- return null;
+ throw new IOException();
}
public String getDescription() {
- return null;
+ return "";
}
public boolean exists() {
@@ -195,7 +195,7 @@ public class EvaluableScriptTest {
}
public Resource createRelativeResource(String relativePath) throws IOException {
- return null;
+ throw new IOException();
}
public long contentLength() throws IOException {
diff --git a/shib-support/src/test/java/net/shibboleth/shared/xml/AttributeSupportTest.java b/shib-support/src/test/java/net/shibboleth/shared/xml/AttributeSupportTest.java
index c5c8c048..9b598e7c 100644
--- a/shib-support/src/test/java/net/shibboleth/shared/xml/AttributeSupportTest.java
+++ b/shib-support/src/test/java/net/shibboleth/shared/xml/AttributeSupportTest.java
@@ -17,6 +17,8 @@
package net.shibboleth.shared.xml;
+import static org.testng.Assert.*;
+
import java.io.IOException;
import java.io.InputStream;
import java.time.Duration;
@@ -34,7 +36,6 @@ import net.shibboleth.shared.component.ComponentInitializationException;
import net.shibboleth.shared.logic.ConstraintViolationException;
import net.shibboleth.shared.xml.impl.BasicParserPool;
-import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -46,6 +47,7 @@ import org.xml.sax.SAXException;
/**
* Tests for {@link AttributeSupport};
*/
+ at SuppressWarnings("javadoc")
public class AttributeSupportTest {
// Contants to test against
@@ -94,19 +96,19 @@ public class AttributeSupportTest {
// Skip whitespace, grab first element
goodBaseIdSpaceLang = (Element) root.getFirstChild().getNextSibling();
- Assert.assertEquals(goodBaseIdSpaceLang.getLocalName(), "GoodBaseIdSpaceLang");
+ assertEquals(goodBaseIdSpaceLang.getLocalName(), "GoodBaseIdSpaceLang");
noBaseIdSpaceLang = (Element) goodBaseIdSpaceLang.getNextSibling().getNextSibling();
- Assert.assertEquals(noBaseIdSpaceLang.getLocalName(), "NoBaseIdSpaceLang");
+ assertEquals(noBaseIdSpaceLang.getLocalName(), "NoBaseIdSpaceLang");
badSpace = (Element) noBaseIdSpaceLang.getNextSibling().getNextSibling();
- Assert.assertEquals(badSpace.getLocalName(), "BadSpace");
+ assertEquals(badSpace.getLocalName(), "BadSpace");
preserveSpace = (Element) badSpace.getNextSibling().getNextSibling();
- Assert.assertEquals(preserveSpace.getLocalName(), "PreserveSpace");
+ assertEquals(preserveSpace.getLocalName(), "PreserveSpace");
attributes = (Element) preserveSpace.getNextSibling().getNextSibling();
- Assert.assertEquals(attributes.getLocalName(), "AttributeTest");
+ assertEquals(attributes.getLocalName(), "AttributeTest");
} finally {
parserPool.returnBuilder(builder);
@@ -149,7 +151,7 @@ public class AttributeSupportTest {
} catch (SAXException e) {
thrown = true;
}
- Assert.assertTrue(
+ assertTrue(
thrown,
"xmlns: declaration with name other than xml and namespace of http://www.w3.org/XML/1998/namespace should throw an error ");
}
@@ -161,7 +163,7 @@ public class AttributeSupportTest {
} catch (SAXException e) {
thrown = true;
}
- Assert.assertTrue(thrown,
+ assertTrue(thrown,
"xmlns:xml with namespace other than http://www.w3.org/XML/1998/namespace should throw an error ");
}
@@ -169,11 +171,11 @@ public class AttributeSupportTest {
}
@Test public void testGetXMLId() {
- Assert.assertEquals(AttributeSupport.getXMLId(goodBaseIdSpaceLang), "identifierGoodBaseIdSpaceLang",
+ assertEquals(AttributeSupport.getXMLId(goodBaseIdSpaceLang), "identifierGoodBaseIdSpaceLang",
"Identifier mismatch");
- Assert.assertNull(AttributeSupport.getXMLId(noBaseIdSpaceLang), "Identifier found erroneously");
- Assert.assertEquals(AttributeSupport.getXMLId(badSpace), "identifierBadSpace", "Identifier mismatch");
- Assert.assertEquals(AttributeSupport.getXMLId(preserveSpace), "identifierPreserveSpace", "Identifier mismatch");
+ assertNull(AttributeSupport.getXMLId(noBaseIdSpaceLang), "Identifier found erroneously");
+ assertEquals(AttributeSupport.getXMLId(badSpace), "identifierBadSpace", "Identifier mismatch");
+ assertEquals(AttributeSupport.getXMLId(preserveSpace), "identifierPreserveSpace", "Identifier mismatch");
// test Add now that we know that get works
boolean thrown = false;
@@ -182,7 +184,7 @@ public class AttributeSupportTest {
} catch (ConstraintViolationException e) {
thrown = true;
}
- Assert.assertTrue(thrown, "null string to addXMLId");
+ assertTrue(thrown, "null string to addXMLId");
thrown = false;
try {
@@ -190,18 +192,18 @@ public class AttributeSupportTest {
} catch (ConstraintViolationException e) {
thrown = true;
}
- Assert.assertTrue(thrown, "null element to addXMLId");
+ assertTrue(thrown, "null element to addXMLId");
- Assert.assertNull(AttributeSupport.getXMLId(createdElement), "xml:space found erroneously (test setup failure)");
+ assertNull(AttributeSupport.getXMLId(createdElement), "xml:space found erroneously (test setup failure)");
AttributeSupport.addXMLId(createdElement, TEST_ID_ATTRIBUTE_VALUE);
- Assert.assertEquals(AttributeSupport.getXMLId(createdElement), TEST_ID_ATTRIBUTE_VALUE, "addXMLId failed");
+ assertEquals(AttributeSupport.getXMLId(createdElement), TEST_ID_ATTRIBUTE_VALUE, "addXMLId failed");
}
@Test public void testXMLBase() {
- Assert.assertEquals(AttributeSupport.getXMLBase(goodBaseIdSpaceLang), "http://example.org/base",
+ assertEquals(AttributeSupport.getXMLBase(goodBaseIdSpaceLang), "http://example.org/base",
"xml:base mismatch");
- Assert.assertNull(AttributeSupport.getXMLBase(noBaseIdSpaceLang), "xml:base found erroneously");
+ assertNull(AttributeSupport.getXMLBase(noBaseIdSpaceLang), "xml:base found erroneously");
// test Add
boolean thrown = false;
@@ -210,7 +212,7 @@ public class AttributeSupportTest {
} catch (ConstraintViolationException e) {
thrown = true;
}
- Assert.assertTrue(thrown, "null string to addXMLBase");
+ assertTrue(thrown, "null string to addXMLBase");
thrown = false;
try {
@@ -218,21 +220,21 @@ public class AttributeSupportTest {
} catch (ConstraintViolationException e) {
thrown = true;
}
- Assert.assertTrue(thrown, "null element to addXMLBase");
+ assertTrue(thrown, "null element to addXMLBase");
- Assert.assertNull(AttributeSupport.getXMLBase(createdElement),
+ assertNull(AttributeSupport.getXMLBase(createdElement),
"xml:base found erroneously (test setup failure)");
AttributeSupport.addXMLBase(createdElement, TEST_NS);
- Assert.assertEquals(AttributeSupport.getXMLBase(createdElement), TEST_NS, "addXMLBase failed");
+ assertEquals(AttributeSupport.getXMLBase(createdElement), TEST_NS, "addXMLBase failed");
}
@Test public void testXMLSpace() {
- Assert.assertEquals(AttributeSupport.getXMLSpace(goodBaseIdSpaceLang), XMLSpace.DEFAULT, "xml:space mismatch");
- Assert.assertNull(AttributeSupport.getXMLSpace(noBaseIdSpaceLang), "xml:space found erroneously");
- Assert.assertNull(AttributeSupport.getXMLSpace(badSpace), "xml:space found erroneously");
+ assertEquals(AttributeSupport.getXMLSpace(goodBaseIdSpaceLang), XMLSpace.DEFAULT, "xml:space mismatch");
+ assertNull(AttributeSupport.getXMLSpace(noBaseIdSpaceLang), "xml:space found erroneously");
+ assertNull(AttributeSupport.getXMLSpace(badSpace), "xml:space found erroneously");
- Assert.assertEquals(AttributeSupport.getXMLSpace(preserveSpace), XMLSpace.PRESERVE, "xml:space mismatch");
+ assertEquals(AttributeSupport.getXMLSpace(preserveSpace), XMLSpace.PRESERVE, "xml:space mismatch");
// test Add
boolean thrown = false;
@@ -241,7 +243,7 @@ public class AttributeSupportTest {
} catch (ConstraintViolationException e) {
thrown = true;
}
- Assert.assertTrue(thrown, "null string to addXMLBase");
+ assertTrue(thrown, "null string to addXMLBase");
thrown = false;
try {
@@ -249,17 +251,17 @@ public class AttributeSupportTest {
} catch (ConstraintViolationException e) {
thrown = true;
}
- Assert.assertTrue(thrown, "null element to addXMLSpace");
+ assertTrue(thrown, "null element to addXMLSpace");
- Assert.assertNull(AttributeSupport.getXMLSpace(createdElement),
+ assertNull(AttributeSupport.getXMLSpace(createdElement),
"xml:space found erroneously (test setup failure)");
AttributeSupport.addXMLSpace(createdElement, XMLSpace.DEFAULT);
- Assert.assertEquals(AttributeSupport.getXMLSpace(createdElement), XMLSpace.DEFAULT, "addXMLSpace failed");
+ assertEquals(AttributeSupport.getXMLSpace(createdElement), XMLSpace.DEFAULT, "addXMLSpace failed");
}
@Test public void testXMLLang() {
- Assert.assertEquals(AttributeSupport.getXMLLang(goodBaseIdSpaceLang), "fr-ca", "xml:lang mismatch");
- Assert.assertNull(AttributeSupport.getXMLLang(noBaseIdSpaceLang), "xml:lang found erroneously");
+ assertEquals(AttributeSupport.getXMLLang(goodBaseIdSpaceLang), "fr-ca", "xml:lang mismatch");
+ assertNull(AttributeSupport.getXMLLang(noBaseIdSpaceLang), "xml:lang found erroneously");
// test Add
boolean thrown = false;
@@ -268,7 +270,7 @@ public class AttributeSupportTest {
} catch (ConstraintViolationException e) {
thrown = true;
}
- Assert.assertTrue(thrown, "null string to addXMLBase");
+ assertTrue(thrown, "null string to addXMLBase");
thrown = false;
try {
@@ -276,162 +278,176 @@ public class AttributeSupportTest {
} catch (ConstraintViolationException e) {
thrown = true;
}
- Assert.assertTrue(thrown, "null element to addXMLLang");
+ assertTrue(thrown, "null element to addXMLLang");
- Assert.assertNull(AttributeSupport.getXMLLang(createdElement),
+ assertNull(AttributeSupport.getXMLLang(createdElement),
"xml:space found erroneously (test setup failure)");
AttributeSupport.addXMLLang(createdElement, "fr");
- Assert.assertEquals(AttributeSupport.getXMLLang(createdElement), "fr", "addXMLLang failed");
+ assertEquals(AttributeSupport.getXMLLang(createdElement), "fr", "addXMLLang failed");
}
@Test public void testGetID() {
- Assert.assertNull(AttributeSupport.getIdAttribute(null), "ID of null is null");
- Assert.assertNull(AttributeSupport.getIdAttribute(createdElement), "ID of non id'd element is null");
+ assertNull(AttributeSupport.getIdAttribute(null), "ID of null is null");
+ assertNull(AttributeSupport.getIdAttribute(createdElement), "ID of non id'd element is null");
- Attr attr = AttributeSupport.getIdAttribute((Element) createdElement.getFirstChild());
- Assert.assertEquals(attr.getValue(), TEST_ID_ATTRIBUTE_VALUE, "ID Attribute value mismatch");
- Assert.assertEquals(attr.getName(), TEST_ID_PREFIXEDATTRIBUTE, "ID Attribute name mismatch");
- Assert.assertEquals(attr.getNamespaceURI(), TEST_NS, "ID Attribute namespace mismatch");
+ final Attr attr = AttributeSupport.getIdAttribute((Element) createdElement.getFirstChild());
+ assert attr != null;
+ assertEquals(attr.getValue(), TEST_ID_ATTRIBUTE_VALUE, "ID Attribute value mismatch");
+ assertEquals(attr.getName(), TEST_ID_PREFIXEDATTRIBUTE, "ID Attribute name mismatch");
+ assertEquals(attr.getNamespaceURI(), TEST_NS, "ID Attribute namespace mismatch");
}
@Test public void testHasAttribute() {
// either parameter null means a false result, not an NPE
- Assert.assertFalse(AttributeSupport.hasAttribute(null, idAttrQName));
- Assert.assertFalse(AttributeSupport.hasAttribute(createdElement, null));
+ assertFalse(AttributeSupport.hasAttribute(null, idAttrQName));
+ assertFalse(AttributeSupport.hasAttribute(createdElement, null));
- Assert.assertFalse(AttributeSupport.hasAttribute(createdElement, idAttrQName), "Attribute lookup by QName");
+ assertFalse(AttributeSupport.hasAttribute(createdElement, idAttrQName), "Attribute lookup by QName");
- Assert.assertTrue(AttributeSupport.hasAttribute(goodBaseIdSpaceLang, XMLConstants.XML_BASE_ATTRIB_NAME),
+ assertTrue(AttributeSupport.hasAttribute(goodBaseIdSpaceLang, XMLConstants.XML_BASE_ATTRIB_NAME),
"attribute lookup by QName from file");
- Assert.assertFalse(AttributeSupport.hasAttribute(noBaseIdSpaceLang, XMLConstants.XML_BASE_ATTRIB_NAME),
+ assertFalse(AttributeSupport.hasAttribute(noBaseIdSpaceLang, XMLConstants.XML_BASE_ATTRIB_NAME),
"attribute lookup by QName from file");
Element child = (Element) createdElement.getFirstChild();
- Assert.assertTrue(AttributeSupport.hasAttribute(child, idAttrQName),
+ assertTrue(AttributeSupport.hasAttribute(child, idAttrQName),
"attribute lookup by QName in created element");
- Assert.assertTrue(
+ assertTrue(
AttributeSupport.hasAttribute(child, new QName(TEST_NS, TEST_ID_ATTRIBUTE, "xx" + TEST_PREFIX)),
"attribute lookup by QName with changed prefix in created element");
- Assert.assertFalse(
+ assertFalse(
AttributeSupport.hasAttribute(child, new QName(TEST_NS + "/f", TEST_ID_ATTRIBUTE, TEST_PREFIX)),
"attribute lookup by QName with changed NS in created element");
}
@Test(dependsOnMethods = {"testHasAttribute"}) public void testConstructAttribute() {
- Assert.assertFalse(AttributeSupport.hasAttribute(createdElement, idAttrQName), "precondition");
+ assertFalse(AttributeSupport.hasAttribute(createdElement, idAttrQName), "precondition");
createdElement.setAttributeNode(AttributeSupport.constructAttribute(document, idAttrQName));
- Assert.assertTrue(AttributeSupport.hasAttribute(createdElement, idAttrQName), "test constructAttribute(QName)");
+ assertTrue(AttributeSupport.hasAttribute(createdElement, idAttrQName), "test constructAttribute(QName)");
QName testQName = new QName(TEST_NS, TEST_ID_ATTRIBUTE + "XX", TEST_PREFIX);
- Assert.assertFalse(AttributeSupport.hasAttribute(createdElement, testQName), "precondition");
+ assertFalse(AttributeSupport.hasAttribute(createdElement, testQName), "precondition");
createdElement.setAttributeNode(AttributeSupport.constructAttribute(document, TEST_NS,
TEST_ID_ATTRIBUTE + "XX", TEST_PREFIX));
- Assert.assertTrue(AttributeSupport.hasAttribute(createdElement, testQName), "test constructAttribute(QName)");
+ assertTrue(AttributeSupport.hasAttribute(createdElement, testQName), "test constructAttribute(QName)");
}
@Test public void testRemoveAttribute() {
- Assert.assertFalse(AttributeSupport.removeAttribute(createdElement, idAttrQName), "Attribute remove by QName");
+ assertFalse(AttributeSupport.removeAttribute(createdElement, idAttrQName), "Attribute remove by QName");
Element child = (Element) createdElement.getFirstChild();
- Assert.assertTrue(AttributeSupport.removeAttribute(child, idAttrQName),
+ assertTrue(AttributeSupport.removeAttribute(child, idAttrQName),
"remove lookup by QName in created element");
- Assert.assertFalse(AttributeSupport.hasAttribute(child, idAttrQName),
+ assertFalse(AttributeSupport.hasAttribute(child, idAttrQName),
"attribute lookup by QName after it has been removed");
}
@Test public void testGetAttributeMethods() {
// getAttribute(Element, QName)
- Assert.assertNull(AttributeSupport.getAttribute(noBaseIdSpaceLang, XMLConstants.XML_ID_ATTRIB_NAME),
+ assertNull(AttributeSupport.getAttribute(noBaseIdSpaceLang, XMLConstants.XML_ID_ATTRIB_NAME),
"no xml:id (lookup by QName)");
- Attr attr = AttributeSupport.getAttribute(goodBaseIdSpaceLang, XMLConstants.XML_ID_ATTRIB_NAME);
- Assert.assertNotNull(attr, "Should have found xml:id attribute");
- Assert.assertEquals(attr.getValue(), "identifierGoodBaseIdSpaceLang",
+ final Attr attr = AttributeSupport.getAttribute(goodBaseIdSpaceLang, XMLConstants.XML_ID_ATTRIB_NAME);
+ assert attr != null;
+ assertEquals(attr.getValue(), "identifierGoodBaseIdSpaceLang",
"Should have found correct attribute by value for xml_id attribute");
// getAttributeValue(Element, QName)
- Assert.assertNull(AttributeSupport.getAttributeValue(goodBaseIdSpaceLang, null),
+ assertNull(AttributeSupport.getAttributeValue(goodBaseIdSpaceLang, null),
"no xml:id (lookup value with null QName)");
- Assert.assertNull(AttributeSupport.getAttributeValue(null, XMLConstants.XML_ID_ATTRIB_NAME),
+ assertNull(AttributeSupport.getAttributeValue(null, XMLConstants.XML_ID_ATTRIB_NAME),
"no xml:id (lookup value with null element)");
- Assert.assertNull(AttributeSupport.getAttributeValue(noBaseIdSpaceLang, XMLConstants.XML_ID_ATTRIB_NAME),
+ assertNull(AttributeSupport.getAttributeValue(noBaseIdSpaceLang, XMLConstants.XML_ID_ATTRIB_NAME),
"no xml:id (lookup value by QName)");
- Assert.assertEquals(AttributeSupport.getAttributeValue(goodBaseIdSpaceLang, XMLConstants.XML_ID_ATTRIB_NAME),
+ assertEquals(AttributeSupport.getAttributeValue(goodBaseIdSpaceLang, XMLConstants.XML_ID_ATTRIB_NAME),
"identifierGoodBaseIdSpaceLang", "Should have found correct value for xml:id attribute by QName");
// getAttributeValue(Element, String, String)
- Assert.assertNull(AttributeSupport.getAttributeValue(badSpace, XMLConstants.XML_NS, null),
+ assertNull(AttributeSupport.getAttributeValue(badSpace, XMLConstants.XML_NS, null),
"no value lookup with null name)");
- Assert.assertNull(AttributeSupport.getAttributeValue(badSpace, XMLConstants.XML_NS, ""),
+ assertNull(AttributeSupport.getAttributeValue(badSpace, XMLConstants.XML_NS, ""),
"no value lookup with empty name)");
- Assert.assertNull(AttributeSupport.getAttributeValue(null, XMLConstants.XML_NS, "space"),
+ assertNull(AttributeSupport.getAttributeValue(null, XMLConstants.XML_NS, "space"),
"no value lookup with null element)");
- Assert.assertNull(AttributeSupport.getAttributeValue(noBaseIdSpaceLang, XMLConstants.XML_NS, "space"),
+ assertNull(AttributeSupport.getAttributeValue(noBaseIdSpaceLang, XMLConstants.XML_NS, "space"),
"no xml:space (lookup value by name)");
- Assert.assertEquals(AttributeSupport.getAttributeValue(badSpace, XMLConstants.XML_NS, "space"), "wibble",
+ assertEquals(AttributeSupport.getAttributeValue(badSpace, XMLConstants.XML_NS, "space"), "wibble",
"Should have found correct value for xml:space attribute by name");
// getAttributeValueAsBoolean(Attribute)
// Use the previously tested AttributeSupport.getAttribute
- Assert.assertNull(AttributeSupport.getAttributeValueAsBoolean(null), "null attribute should be null");
- Assert.assertNull(AttributeSupport.getAttributeValueAsBoolean(AttributeSupport.getAttribute(attributes,
+ assertNull(AttributeSupport.getAttributeValueAsBoolean(null), "null attribute should be null");
+ assertNull(AttributeSupport.getAttributeValueAsBoolean(AttributeSupport.getAttribute(attributes,
new QName(TEST_NS, "testAttrEmpty"))), "\"\" should be null");
- Assert.assertFalse(AttributeSupport.getAttributeValueAsBoolean(AttributeSupport.getAttribute(attributes,
- new QName(TEST_NS, "testAttrZero"))), "0 should be false");
- Assert.assertTrue(AttributeSupport.getAttributeValueAsBoolean(AttributeSupport.getAttribute(attributes,
- new QName(TEST_NS, "testAttrOne"))), "1 should be true");
- Assert.assertNull(AttributeSupport.getAttributeValueAsBoolean(AttributeSupport.getAttribute(attributes,
+
+ Boolean flag = AttributeSupport.getAttributeValueAsBoolean(AttributeSupport.getAttribute(attributes,
+ new QName(TEST_NS, "testAttrZero")));
+ assert flag != null;
+ assertFalse(flag, "0 should be false");
+
+ flag = AttributeSupport.getAttributeValueAsBoolean(AttributeSupport.getAttribute(attributes,
+ new QName(TEST_NS, "testAttrOne")));
+ assert flag != null;
+ assertTrue(flag, "1 should be true");
+
+ assertNull(AttributeSupport.getAttributeValueAsBoolean(AttributeSupport.getAttribute(attributes,
new QName(TEST_NS, "testAttrThree"))), "2 should be null");
- Assert.assertFalse(AttributeSupport.getAttributeValueAsBoolean(AttributeSupport.getAttribute(attributes,
- new QName(TEST_NS, "testAttrFalse"))), "false should be false");
- Assert.assertTrue(AttributeSupport.getAttributeValueAsBoolean(AttributeSupport.getAttribute(attributes,
- new QName(TEST_NS, "testAttrTrue"))), "true should be true");
- Assert.assertNull(AttributeSupport.getAttributeValueAsBoolean(AttributeSupport.getAttribute(attributes,
+
+ flag = AttributeSupport.getAttributeValueAsBoolean(AttributeSupport.getAttribute(attributes,
+ new QName(TEST_NS, "testAttrFalse")));
+ assert flag != null;
+ assertFalse(flag, "false should be false");
+
+ flag = AttributeSupport.getAttributeValueAsBoolean(AttributeSupport.getAttribute(attributes,
+ new QName(TEST_NS, "testAttrTrue")));
+ assert flag != null;
+ assertTrue(flag, "true should be true");
+ assertNull(AttributeSupport.getAttributeValueAsBoolean(AttributeSupport.getAttribute(attributes,
new QName(TEST_NS, "testAttrTrueCaps"))), "TRUE should be null");
// getAttributeValueAsList(Attribute)
// Use the previously tested AttributeSupport.getAttribute
- Assert.assertTrue(AttributeSupport.getAttributeValueAsList(null).isEmpty(),
+ assertTrue(AttributeSupport.getAttributeValueAsList(null).isEmpty(),
"null attribute should give empty list");
- Assert.assertTrue(
+ assertTrue(
AttributeSupport.getAttributeValueAsList(
AttributeSupport.getAttribute(attributes, new QName(TEST_NS, "testAttrEmpty"))).isEmpty(),
"\"\" attribute should give empty list");
- Assert.assertEquals(AttributeSupport.getAttributeValueAsList(AttributeSupport.getAttribute(attributes,
+ assertEquals(AttributeSupport.getAttributeValueAsList(AttributeSupport.getAttribute(attributes,
new QName(TEST_NS, "testAttrZero"))), Arrays.asList("0"), "attribute called testAttrZero");
- Assert.assertEquals(AttributeSupport.getAttributeValueAsList(AttributeSupport.getAttribute(attributes,
+ assertEquals(AttributeSupport.getAttributeValueAsList(AttributeSupport.getAttribute(attributes,
new QName(TEST_NS, "testAttrList"))), Arrays.asList("0", "1", "2", "3", "4", "5", "6"),
"attribute called testAttrList");
// getAttributeValueAsQName(Attribute)
// Use the previously tested AttributeSupport.getAttribute
- Assert.assertNull(AttributeSupport.getAttributeValueAsQName(null), "null attribute should be null");
- Assert.assertNull(AttributeSupport.getAttributeValueAsQName(AttributeSupport.getAttribute(attributes,
+ assertNull(AttributeSupport.getAttributeValueAsQName(null), "null attribute should be null");
+ assertNull(AttributeSupport.getAttributeValueAsQName(AttributeSupport.getAttribute(attributes,
new QName(TEST_NS, "testAttrEmpty"))), "\"\" should be null");
- Assert.assertEquals(AttributeSupport.getAttributeValueAsQName(AttributeSupport.getAttribute(attributes,
+ assertEquals(AttributeSupport.getAttributeValueAsQName(AttributeSupport.getAttribute(attributes,
new QName(TEST_NS, "testAttrQName"))), idAttrQName, "attribute called testAttrQName");
- Assert.assertEquals(AttributeSupport.getAttributeValueAsQName(AttributeSupport.getAttribute(attributes,
+ assertEquals(AttributeSupport.getAttributeValueAsQName(AttributeSupport.getAttribute(attributes,
new QName(TEST_NS, "testAttrZero"))), new QName("0"), "attribute called testAttrZero");
// getDateTimeAttribute
// Use the previously tested AttributeSupport.getAttribute
- Assert.assertNull(AttributeSupport.getDateTimeAttribute(null), "null attribute should be null");
- Assert.assertNull(AttributeSupport.getDateTimeAttribute(AttributeSupport.getAttribute(attributes,
+ assertNull(AttributeSupport.getDateTimeAttribute(null), "null attribute should be null");
+ assertNull(AttributeSupport.getDateTimeAttribute(AttributeSupport.getAttribute(attributes,
new QName(TEST_NS, "testAttrEmpty"))), "\"\" should be null");
- Assert.assertNull(AttributeSupport.getDateTimeAttribute(AttributeSupport.getAttribute(attributes,
+ assertNull(AttributeSupport.getDateTimeAttribute(AttributeSupport.getAttribute(attributes,
new QName(TEST_NS, "testAttrEmpty"))), "\"0\" should be null");
- Assert.assertEquals(
+ assertEquals(
AttributeSupport.getDateTimeAttribute(
AttributeSupport.getAttribute(attributes, new QName(TEST_NS, "testAttrEpochPlusOneSec"))),
Instant.ofEpochSecond(1), "attribute called testAttrEpochPlusOneSec");
// getDurationAttributeValueAsLong
// Use the previously tested AttributeSupport.getAttribute
- Assert.assertNull(AttributeSupport.getDurationAttributeValue(null), "null attribute should be null");
- Assert.assertNull(AttributeSupport.getDurationAttributeValue(AttributeSupport.getAttribute(attributes,
+ assertNull(AttributeSupport.getDurationAttributeValue(null), "null attribute should be null");
+ assertNull(AttributeSupport.getDurationAttributeValue(AttributeSupport.getAttribute(attributes,
new QName(TEST_NS, "testAttrEmpty"))), "\"\" should be null");
- Assert.assertNull(AttributeSupport.getDurationAttributeValue(AttributeSupport.getAttribute(attributes,
+ assertNull(AttributeSupport.getDurationAttributeValue(AttributeSupport.getAttribute(attributes,
new QName(TEST_NS, "testAttrEmpty"))), "\"0\" should be null");
- Assert.assertEquals(
+ assertEquals(
AttributeSupport.getDurationAttributeValue(
AttributeSupport.getAttribute(attributes, new QName(TEST_NS, "testAttrMinusOneDay"))),
Duration.ofDays(-1), "attribute called testAttrMinusOneDay");
@@ -443,14 +459,14 @@ public class AttributeSupportTest {
QName qName = new QName(TEST_NS, qNameBase, TEST_PREFIX);
- Assert.assertNull(AttributeSupport.getAttributeValue(createdElement, qName), "Test precondition");
+ assertNull(AttributeSupport.getAttributeValue(createdElement, qName), "Test precondition");
boolean thrown = false;
try {
AttributeSupport.appendAttribute(nullValue(), qName, testResult);
} catch (ConstraintViolationException e) {
thrown = true;
}
- Assert.assertTrue(thrown, "null element should throw");
+ assertTrue(thrown, "null element should throw");
thrown = false;
try {
@@ -458,7 +474,7 @@ public class AttributeSupportTest {
} catch (ConstraintViolationException e) {
thrown = true;
}
- Assert.assertTrue(thrown, "null qname should throw");
+ assertTrue(thrown, "null qname should throw");
thrown = false;
try {
@@ -466,7 +482,7 @@ public class AttributeSupportTest {
} catch (ConstraintViolationException e) {
thrown = true;
}
- Assert.assertTrue(thrown, "null string should throw");
+ assertTrue(thrown, "null string should throw");
thrown = false;
try {
@@ -474,16 +490,16 @@ public class AttributeSupportTest {
} catch (ConstraintViolationException e) {
thrown = true;
}
- Assert.assertFalse(thrown, "All non nulls should not throw");
- Assert.assertEquals(AttributeSupport.getAttributeValue(createdElement, qName), testResult,
+ assertFalse(thrown, "All non nulls should not throw");
+ assertEquals(AttributeSupport.getAttributeValue(createdElement, qName), testResult,
"appendAttribute(Element, QName, String) failed");
// appendAttribute(Element, QName, String, boolean)
qNameBase = qNameBase + "New";
testResult = testResult + "New";
qName = new QName(TEST_NS, qNameBase, TEST_PREFIX);
- Assert.assertNull(AttributeSupport.getAttributeValue(createdElement, qName), "Test precondition");
- Assert.assertNull(AttributeSupport.getIdAttribute(createdElement), "Test precondition");
+ assertNull(AttributeSupport.getAttributeValue(createdElement, qName), "Test precondition");
+ assertNull(AttributeSupport.getIdAttribute(createdElement), "Test precondition");
thrown = false;
try {
@@ -491,7 +507,7 @@ public class AttributeSupportTest {
} catch (ConstraintViolationException e) {
thrown = true;
}
- Assert.assertTrue(thrown, "null element should throw");
+ assertTrue(thrown, "null element should throw");
thrown = false;
try {
@@ -499,7 +515,7 @@ public class AttributeSupportTest {
} catch (ConstraintViolationException e) {
thrown = true;
}
- Assert.assertTrue(thrown, "null qname should throw");
+ assertTrue(thrown, "null qname should throw");
thrown = false;
try {
@@ -507,7 +523,7 @@ public class AttributeSupportTest {
} catch (ConstraintViolationException e) {
thrown = true;
}
- Assert.assertTrue(thrown, "null string should throw");
+ assertTrue(thrown, "null string should throw");
thrown = false;
try {
@@ -515,18 +531,21 @@ public class AttributeSupportTest {
} catch (ConstraintViolationException e) {
thrown = true;
}
- Assert.assertFalse(thrown, "All non nulls should not throw");
- Assert.assertEquals(AttributeSupport.getAttributeValue(createdElement, qName), testResult,
+ assertFalse(thrown, "All non nulls should not throw");
+ assertEquals(AttributeSupport.getAttributeValue(createdElement, qName), testResult,
"appendAttribute(Element, QName, String) failed");
- Assert.assertNull(AttributeSupport.getIdAttribute(createdElement), "Should not have added an id Attribute");
+ assertNull(AttributeSupport.getIdAttribute(createdElement), "Should not have added an id Attribute");
qNameBase = qNameBase + "New";
testResult = testResult + "New";
qName = new QName(TEST_NS, qNameBase, TEST_PREFIX);
- Assert.assertNull(AttributeSupport.getAttributeValue(createdElement, qName), "Test precondition");
- Assert.assertNull(AttributeSupport.getIdAttribute(createdElement), "Test precondition");
+ assertNull(AttributeSupport.getAttributeValue(createdElement, qName), "Test precondition");
+ assertNull(AttributeSupport.getIdAttribute(createdElement), "Test precondition");
AttributeSupport.appendAttribute(createdElement, qName, testResult, true);
- Assert.assertEquals(AttributeSupport.getIdAttribute(createdElement).getValue(), testResult,
+
+ Attr id = AttributeSupport.getIdAttribute(createdElement);
+ assert id != null;
+ assertEquals(id.getValue(), testResult,
"id Attribute added correctly");
AttributeSupport.removeAttribute(createdElement, qName);
@@ -535,8 +554,8 @@ public class AttributeSupportTest {
List<String> data = Arrays.asList("one", "2", "iii");
testResult = "one 2 iii";
qName = new QName(TEST_NS, qNameBase, TEST_PREFIX);
- Assert.assertNull(AttributeSupport.getAttributeValue(createdElement, qName), "Test precondition");
- Assert.assertNull(AttributeSupport.getIdAttribute(createdElement), "Test precondition");
+ assertNull(AttributeSupport.getAttributeValue(createdElement, qName), "Test precondition");
+ assertNull(AttributeSupport.getIdAttribute(createdElement), "Test precondition");
thrown = false;
try {
@@ -544,7 +563,7 @@ public class AttributeSupportTest {
} catch (ConstraintViolationException e) {
thrown = true;
}
- Assert.assertTrue(thrown, "null element should throw");
+ assertTrue(thrown, "null element should throw");
thrown = false;
try {
@@ -552,7 +571,7 @@ public class AttributeSupportTest {
} catch (ConstraintViolationException e) {
thrown = true;
}
- Assert.assertTrue(thrown, "null qname should throw");
+ assertTrue(thrown, "null qname should throw");
thrown = false;
try {
@@ -560,7 +579,7 @@ public class AttributeSupportTest {
} catch (ConstraintViolationException e) {
thrown = true;
}
- Assert.assertTrue(thrown, "null string should throw");
+ assertTrue(thrown, "null string should throw");
thrown = false;
try {
@@ -568,30 +587,32 @@ public class AttributeSupportTest {
} catch (ConstraintViolationException e) {
thrown = true;
}
- Assert.assertFalse(thrown, "All non nulls should not throw");
- Assert.assertEquals(AttributeSupport.getAttributeValue(createdElement, qName), testResult,
+ assertFalse(thrown, "All non nulls should not throw");
+ assertEquals(AttributeSupport.getAttributeValue(createdElement, qName), testResult,
"appendAttribute(Element, QName, String) failed");
- Assert.assertNull(AttributeSupport.getIdAttribute(createdElement), "Should not have added an id Attribute");
+ assertNull(AttributeSupport.getIdAttribute(createdElement), "Should not have added an id Attribute");
qNameBase = qNameBase + "New";
qName = new QName(TEST_NS, qNameBase, TEST_PREFIX);
- Assert.assertNull(AttributeSupport.getAttributeValue(createdElement, qName), "Test precondition");
- Assert.assertNull(AttributeSupport.getIdAttribute(createdElement), "Test precondition");
+ assertNull(AttributeSupport.getAttributeValue(createdElement, qName), "Test precondition");
+ assertNull(AttributeSupport.getIdAttribute(createdElement), "Test precondition");
AttributeSupport.appendAttribute(createdElement, qName, data, true);
- Assert.assertEquals(AttributeSupport.getIdAttribute(createdElement).getValue(), testResult,
- "id Attribute added correctly");
+
+ id = AttributeSupport.getIdAttribute(createdElement);
+ assert id != null;
+ assertEquals(id.getValue(), testResult, "id Attribute added correctly");
final var duration = Duration.ofSeconds(1);
qNameBase = qNameBase + "New";
qName = new QName(TEST_NS, qNameBase, TEST_PREFIX);
- Assert.assertNull(AttributeSupport.getAttributeValue(createdElement, qName), "Test precondition");
+ assertNull(AttributeSupport.getAttributeValue(createdElement, qName), "Test precondition");
thrown = false;
try {
AttributeSupport.appendDurationAttribute(nullValue(), qName, duration);
} catch (ConstraintViolationException e) {
thrown = true;
}
- Assert.assertTrue(thrown, "null element should throw");
+ assertTrue(thrown, "null element should throw");
thrown = false;
try {
@@ -599,7 +620,7 @@ public class AttributeSupportTest {
} catch (ConstraintViolationException e) {
thrown = true;
}
- Assert.assertTrue(thrown, "null qname should throw");
+ assertTrue(thrown, "null qname should throw");
thrown = false;
try {
@@ -607,8 +628,8 @@ public class AttributeSupportTest {
} catch (ConstraintViolationException e) {
thrown = true;
}
- Assert.assertFalse(thrown, "All non nulls should not throw");
- Assert.assertEquals(
+ assertFalse(thrown, "All non nulls should not throw");
+ assertEquals(
AttributeSupport.getDurationAttributeValue(AttributeSupport.getAttribute(createdElement, qName)),
duration, "getDurationAttributeValueAsLong failed");
@@ -617,14 +638,14 @@ public class AttributeSupportTest {
final var time = Instant.now().truncatedTo(ChronoUnit.MILLIS);
qNameBase = qNameBase + "New";
qName = new QName(TEST_NS, qNameBase, TEST_PREFIX);
- Assert.assertNull(AttributeSupport.getAttributeValue(createdElement, qName), "Test precondition");
+ assertNull(AttributeSupport.getAttributeValue(createdElement, qName), "Test precondition");
thrown = false;
try {
AttributeSupport.appendDateTimeAttribute(nullValue(), qName, time);
} catch (ConstraintViolationException e) {
thrown = true;
}
- Assert.assertTrue(thrown, "null element should throw");
+ assertTrue(thrown, "null element should throw");
thrown = false;
try {
@@ -632,7 +653,7 @@ public class AttributeSupportTest {
} catch (ConstraintViolationException e) {
thrown = true;
}
- Assert.assertTrue(thrown, "null qname should throw");
+ assertTrue(thrown, "null qname should throw");
thrown = false;
try {
@@ -640,8 +661,8 @@ public class AttributeSupportTest {
} catch (ConstraintViolationException e) {
thrown = true;
}
- Assert.assertFalse(thrown, "All non nulls should not throw");
- Assert.assertEquals(
+ assertFalse(thrown, "All non nulls should not throw");
+ assertEquals(
AttributeSupport.getDateTimeAttribute(AttributeSupport.getAttribute(createdElement, qName)),
time, "getDurationAttributeValueAsLong failed");
diff --git a/shib-support/src/test/java/net/shibboleth/shared/xml/DOMTypeSupportTest.java b/shib-support/src/test/java/net/shibboleth/shared/xml/DOMTypeSupportTest.java
index bb488372..ca4eea1e 100644
--- a/shib-support/src/test/java/net/shibboleth/shared/xml/DOMTypeSupportTest.java
+++ b/shib-support/src/test/java/net/shibboleth/shared/xml/DOMTypeSupportTest.java
@@ -37,6 +37,7 @@ import net.shibboleth.shared.xml.impl.BasicParserPool;
/**
* Tests for {@link DOMTypeSupport};
*/
+ at SuppressWarnings("javadoc")
public class DOMTypeSupportTest {
private ParserPool parserPool;
diff --git a/shib-support/src/test/java/net/shibboleth/shared/xml/ElementSupportTest.java b/shib-support/src/test/java/net/shibboleth/shared/xml/ElementSupportTest.java
index 71e12bc4..bd9f1038 100644
--- a/shib-support/src/test/java/net/shibboleth/shared/xml/ElementSupportTest.java
+++ b/shib-support/src/test/java/net/shibboleth/shared/xml/ElementSupportTest.java
@@ -44,6 +44,7 @@ import org.xml.sax.SAXException;
* Test {@link ElementSupport}. These tests use {@link Test#dependsOnMethods()} to ensure that we suppress a test if
* functionality it relies on has not been tested correctly. This avoids false failures.
*/
+ at SuppressWarnings("javadoc")
public class ElementSupportTest {
@Nonnull @NotEmpty private static final String TEST_NS = "http://example.org/NameSpace";
@@ -165,7 +166,9 @@ public class ElementSupportTest {
Assert.assertTrue(ElementSupport.getElementContentAsString(null).isEmpty(),
"getElementContentAsList: Null element should provide empty result");
- Assert.assertTrue(StringSupport.trim(ElementSupport.getElementContentAsString(rootElement)).isEmpty(),
+ final String empty = StringSupport.trim(ElementSupport.getElementContentAsString(rootElement));
+ assert empty != null;
+ Assert.assertTrue(empty.isEmpty(),
"getElementContentAsList: Empty element should provide empty result");
Element interesting =
diff --git a/shib-support/src/test/java/net/shibboleth/shared/xml/NamespaceSupportTest.java b/shib-support/src/test/java/net/shibboleth/shared/xml/NamespaceSupportTest.java
index d1b365e6..689a90e1 100644
--- a/shib-support/src/test/java/net/shibboleth/shared/xml/NamespaceSupportTest.java
+++ b/shib-support/src/test/java/net/shibboleth/shared/xml/NamespaceSupportTest.java
@@ -36,6 +36,7 @@ import net.shibboleth.shared.xml.impl.BasicParserPool;
/**
* Tests for {@link NamespaceSupport}
*/
+ at SuppressWarnings("javadoc")
public class NamespaceSupportTest {
private Element parent;
diff --git a/shib-support/src/test/java/net/shibboleth/shared/xml/QNameSupportTest.java b/shib-support/src/test/java/net/shibboleth/shared/xml/QNameSupportTest.java
index 84cfa065..fe0c1a39 100644
--- a/shib-support/src/test/java/net/shibboleth/shared/xml/QNameSupportTest.java
+++ b/shib-support/src/test/java/net/shibboleth/shared/xml/QNameSupportTest.java
@@ -39,6 +39,7 @@ import org.xml.sax.SAXException;
/**
* Tests for {@link DOMTypeSupport};
*/
+ at SuppressWarnings("javadoc")
public class QNameSupportTest {
@Nonnull @NotEmpty private static final String NAME_1 = "name1";
@@ -143,11 +144,13 @@ public class QNameSupportTest {
@Test public void testGetNodeQName() {
QName qn = QNameSupport.getNodeQName(parent);
+ assert qn != null;
Assert.assertEquals(qn.getLocalPart(), "Parent", "Get Node QName");
Assert.assertEquals(qn.getNamespaceURI(), DEFAULT_NAMESPACE, "Get Node QName");
Assert.assertEquals(qn.getPrefix(), "", "Get Node QName");
qn = QNameSupport.getNodeQName(child);
+ assert qn != null;
Assert.assertEquals(qn.getLocalPart(), "Child", "Get Node QName");
Assert.assertEquals(qn.getNamespaceURI(), NAMESPACE_1, "Get Node QName");
Assert.assertEquals(qn.getPrefix(), PREFIX_1, "Get Node QName");
diff --git a/shib-support/src/test/java/net/shibboleth/shared/xml/SchemaBuilderTest.java b/shib-support/src/test/java/net/shibboleth/shared/xml/SchemaBuilderTest.java
index f979ddc6..b7c60573 100644
--- a/shib-support/src/test/java/net/shibboleth/shared/xml/SchemaBuilderTest.java
+++ b/shib-support/src/test/java/net/shibboleth/shared/xml/SchemaBuilderTest.java
@@ -37,6 +37,7 @@ import net.shibboleth.shared.component.ComponentInitializationException;
/**
* Tests for {@link NamespaceSupport}
*/
+ at SuppressWarnings("javadoc")
public class SchemaBuilderTest {
private static final String TEST_DIR = "/net/shibboleth/shared/xml/schemaBuilderTestDir/";
diff --git a/shib-support/src/test/java/net/shibboleth/shared/xml/SerializeSupportTest.java b/shib-support/src/test/java/net/shibboleth/shared/xml/SerializeSupportTest.java
index 3bab0cbd..280eeccf 100644
--- a/shib-support/src/test/java/net/shibboleth/shared/xml/SerializeSupportTest.java
+++ b/shib-support/src/test/java/net/shibboleth/shared/xml/SerializeSupportTest.java
@@ -47,6 +47,7 @@ import net.shibboleth.shared.xml.impl.BasicParserPool;
/**
* Tests for {@link NamespaceSupport}
*/
+ at SuppressWarnings("javadoc")
public class SerializeSupportTest {
private Element parent;
diff --git a/shib-support/src/test/java/net/shibboleth/shared/xml/XMLSpaceTest.java b/shib-support/src/test/java/net/shibboleth/shared/xml/XMLSpaceTest.java
index a48f9b51..6b7fbd76 100644
--- a/shib-support/src/test/java/net/shibboleth/shared/xml/XMLSpaceTest.java
+++ b/shib-support/src/test/java/net/shibboleth/shared/xml/XMLSpaceTest.java
@@ -24,6 +24,7 @@ import org.testng.annotations.Test;
/**
* Tests for {@link XMLSpace};
*/
+ at SuppressWarnings("javadoc")
public class XMLSpaceTest {
@Test
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list