[java-metadata-aggregator] 04/04: Nullability

Ian Young ian at iay.org.uk
Tue Apr 4 11:19:55 UTC 2023


This is an automated email from the git hooks/post-receive script.

iay pushed a commit to branch main
in repository java-metadata-aggregator.

View the commit online:
http://git.shibboleth.net/view/?p=java-metadata-aggregator.git;a=commit;h=635d2766c3c7b41ae3bb8d3772e7f0e2da5c7ce5

commit 635d2766c3c7b41ae3bb8d3772e7f0e2da5c7ce5
Author: Ian Young <ian at iay.org.uk>
AuthorDate: Tue Apr 4 12:19:44 2023 +0100

    Nullability
---
 .../metadata/SimpleItemCollectionSerializer.java   |  1 +
 .../metadata/dom/XMLSchemaValidationStage.java     |  5 ++---
 .../metadata/dom/ds/X509ValidationStage.java       |  6 ++++--
 .../saml/mdattr/RegistrationAuthorityMatcher.java  |  4 ++--
 .../metadata/pipeline/StaticItemSourceStage.java   |  2 +-
 .../pipeline/impl/NoOpItemOrderingStrategy.java    |  3 ++-
 .../util/PathSegmentStringTransformer.java         |  3 +--
 .../metadata/validate/ValidatorSequence.java       |  4 ++--
 .../java/net/shibboleth/metadata/ItemTagTest.java  | 11 +++++++---
 .../java/net/shibboleth/metadata/MockItem.java     |  5 +++--
 .../SimpleItemCollectionSerializerTest.java        |  4 +++-
 .../dom/StringAttributeValidationStageTest.java    |  4 ++--
 .../dom/StringElementValidationStageTest.java      |  8 ++++---
 .../dom/WhitespaceTrimmingVisitorTest.java         |  1 +
 .../metadata/dom/ds/X509ValidationStageTest.java   |  4 +++-
 .../dom/saml/AttributeElementMatcherTest.java      |  9 +++++++-
 .../dom/saml/AttributeValueElementMakerTest.java   |  1 +
 .../metadata/dom/saml/GenerateIdStageTest.java     |  5 +++--
 .../dom/saml/PullUpCacheDurationStageTest.java     |  1 +
 .../dom/saml/RemoveOrganizationStageTest.java      |  3 +++
 .../saml/SAMLStringElementCheckingStageTest.java   |  6 +++---
 .../dom/saml/SetCacheDurationStageTest.java        | 19 ++++++++++++----
 .../metadata/dom/saml/SetValidUntilStageTest.java  | 10 ++++++++-
 .../dom/saml/ValidateValidUntilStageTest.java      | 11 +++++++---
 .../FilesInDirectoryMultiOutputStrategyTest.java   |  2 ++
 .../pipeline/ItemIdTransformStageTest.java         |  5 +++--
 .../pipeline/PipelineDemultiplexerStageTest.java   | 23 +++++++++++---------
 .../metadata/pipeline/ScriptletStageTest.java      | 11 +++++-----
 .../metadata/pipeline/SerializationStageTest.java  |  9 +++++---
 .../metadata/pipeline/SplitMergeStageTest.java     | 25 ++++++++++++----------
 .../pipeline/StaticItemSourceStageTest.java        |  4 ++--
 .../pipeline/StatusMetadataLoggingStageTest.java   | 14 ++++++------
 .../metadata/pipeline/TerminatingStage.java        |  4 +++-
 .../validate/x509/BaseX509ValidatorTest.java       | 13 +++++++----
 34 files changed, 156 insertions(+), 84 deletions(-)

diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/SimpleItemCollectionSerializer.java b/mda-framework/src/main/java/net/shibboleth/metadata/SimpleItemCollectionSerializer.java
index 2634b54..41eceeb 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/SimpleItemCollectionSerializer.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/SimpleItemCollectionSerializer.java
@@ -52,6 +52,7 @@ public class SimpleItemCollectionSerializer<T> implements ItemCollectionSerializ
             @Nonnull final OutputStream output)
         throws IOException {
         for (final Item<T> item : items) {
+            assert item != null;
             serializer.serialize(item, output);
         }
     }
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/dom/XMLSchemaValidationStage.java b/mda-framework/src/main/java/net/shibboleth/metadata/dom/XMLSchemaValidationStage.java
index 4a942a1..b04d1c4 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/dom/XMLSchemaValidationStage.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/dom/XMLSchemaValidationStage.java
@@ -21,7 +21,6 @@ import java.io.IOException;
 import java.util.List;
 
 import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
 import javax.annotation.concurrent.GuardedBy;
 import javax.annotation.concurrent.ThreadSafe;
 import javax.xml.transform.dom.DOMSource;
@@ -95,9 +94,9 @@ public class XMLSchemaValidationStage extends AbstractIteratingStage<Element> {
      * @param resources schema resources against which Elements are validated
      */
     public synchronized void setSchemaResources(
-            @Nullable @NonnullElements @Unmodifiable final List<Resource> resources) {
+            final @Nonnull @NonnullElements @Unmodifiable List<Resource> resources) {
         checkSetterPreconditions();
-        schemaResources = List.copyOf(resources);
+        schemaResources = CollectionSupport.copyToList(resources);
     }
 
     /**
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/dom/ds/X509ValidationStage.java b/mda-framework/src/main/java/net/shibboleth/metadata/dom/ds/X509ValidationStage.java
index 45e062e..6910d58 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/dom/ds/X509ValidationStage.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/dom/ds/X509ValidationStage.java
@@ -113,13 +113,15 @@ public class X509ValidationStage extends AbstractDOMValidationStage<X509Certific
     @Override
     protected void visit(@Nonnull final Element element, @Nonnull final Context context) 
         throws StageProcessingException {
-        final String text = element.getTextContent();        
+        final String text = element.getTextContent();
+        assert text != null;
         try {
             final byte[] data = Base64Support.decode(text);
 
             final X509Certificate cert;
             synchronized (this) {
                     cert = (X509Certificate) factory.generateCertificate(new ByteArrayInputStream(data));
+                    assert cert != null;
             }
 
             // only process each certificate once per item
@@ -129,7 +131,7 @@ public class X509ValidationStage extends AbstractDOMValidationStage<X509Certific
             }
         } catch (final CertificateException e) {
             addError(context.getItem(), element, "X.509 certificate: " + e.getMessage());
-        } catch (DecodingException e) {
+        } catch (final DecodingException e) {
             addError(context.getItem(), element, "could not convert X509Certficate data");
         }
     }
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/mdattr/RegistrationAuthorityMatcher.java b/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/mdattr/RegistrationAuthorityMatcher.java
index 90a962b..b83a732 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/mdattr/RegistrationAuthorityMatcher.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/mdattr/RegistrationAuthorityMatcher.java
@@ -19,7 +19,6 @@ package net.shibboleth.metadata.dom.saml.mdattr;
 
 import java.util.function.Predicate;
 
-import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 import javax.annotation.concurrent.Immutable;
 
@@ -50,11 +49,12 @@ public class RegistrationAuthorityMatcher implements Predicate<EntityAttributeCo
     }
 
     @Override
-    public boolean test(@Nonnull final EntityAttributeContext input) {
+    public boolean test(final EntityAttributeContext input) {
         if (registrationAuthority == null) {
             // match entities *without* a registration authority
             return null == input.getRegistrationAuthority();
         }
+        assert registrationAuthority != null;
         return registrationAuthority.equals(input.getRegistrationAuthority());
     }
 
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/StaticItemSourceStage.java b/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/StaticItemSourceStage.java
index 76c18e9..4434744 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/StaticItemSourceStage.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/StaticItemSourceStage.java
@@ -58,7 +58,7 @@ public class StaticItemSourceStage<T> extends AbstractStage<T> {
     public synchronized void setSourceItems(
             @Nonnull @NonnullElements @Unmodifiable final List<Item<T>> items) {
         checkSetterPreconditions();
-        source = List.copyOf(items);
+        source = CollectionSupport.copyToList(items);
     }
 
     @Override
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/impl/NoOpItemOrderingStrategy.java b/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/impl/NoOpItemOrderingStrategy.java
index eaa35d2..70936db 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/impl/NoOpItemOrderingStrategy.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/impl/NoOpItemOrderingStrategy.java
@@ -26,6 +26,7 @@ import net.shibboleth.metadata.Item;
 import net.shibboleth.metadata.pipeline.ItemOrderingStrategy;
 import net.shibboleth.shared.annotation.constraint.NonnullElements;
 import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
 
 /**
  * An ordering strategy that simply returns the collection in whatever order it was already in.
@@ -40,7 +41,7 @@ public class NoOpItemOrderingStrategy<T> implements ItemOrderingStrategy<T> {
     @Override
     @Nonnull @NonnullElements @Unmodifiable
     public List<Item<T>> order(@Nonnull @NonnullElements @Unmodifiable final List<Item<T>> items) {
-        return List.copyOf(items);
+        return CollectionSupport.copyToList(items);
     }
 
 }
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/util/PathSegmentStringTransformer.java b/mda-framework/src/main/java/net/shibboleth/metadata/util/PathSegmentStringTransformer.java
index 7554ffe..363389f 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/util/PathSegmentStringTransformer.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/util/PathSegmentStringTransformer.java
@@ -19,7 +19,6 @@ package net.shibboleth.metadata.util;
 
 import java.util.function.Function;
 
-import javax.annotation.Nonnull;
 import javax.annotation.concurrent.Immutable;
 
 import com.google.common.net.UrlEscapers;
@@ -37,7 +36,7 @@ import com.google.common.net.UrlEscapers;
 public class PathSegmentStringTransformer implements Function<String, String> {
 
     @Override
-    public String apply(@Nonnull final String input) {
+    public String apply(final String input) {
         return UrlEscapers.urlPathSegmentEscaper().escape(input);
     }
 
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/validate/ValidatorSequence.java b/mda-framework/src/main/java/net/shibboleth/metadata/validate/ValidatorSequence.java
index f3af034..28dce6c 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/validate/ValidatorSequence.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/validate/ValidatorSequence.java
@@ -57,7 +57,7 @@ public class ValidatorSequence<V> extends BaseValidator implements Validator<V>
     public synchronized void setValidators(
             @Nonnull @NonnullElements @Unmodifiable final List<Validator<V>> newValidators) {
         checkSetterPreconditions();
-        validators = List.copyOf(newValidators);
+        validators = CollectionSupport.copyToList(newValidators);
     }
 
     /**
@@ -71,7 +71,7 @@ public class ValidatorSequence<V> extends BaseValidator implements Validator<V>
     }
 
     @Override
-    public Action validate(@Nonnull final V value, @Nonnull final Item<?> item, @Nonnull final String stageId)
+    public @Nonnull Action validate(@Nonnull final V value, @Nonnull final Item<?> item, @Nonnull final String stageId)
             throws StageProcessingException {
         for (final Validator<V> validator: getValidators()) {
             final Action action = validator.validate(value, item, stageId);
diff --git a/mda-framework/src/test/java/net/shibboleth/metadata/ItemTagTest.java b/mda-framework/src/test/java/net/shibboleth/metadata/ItemTagTest.java
index f67a0f4..467d65d 100644
--- a/mda-framework/src/test/java/net/shibboleth/metadata/ItemTagTest.java
+++ b/mda-framework/src/test/java/net/shibboleth/metadata/ItemTagTest.java
@@ -25,7 +25,8 @@ import org.testng.annotations.Test;
 /** Unit test for {@link ItemTag}. */
 public class ItemTagTest {
 
-    @Test public void test() {
+    @Test
+    public void test() {
         ItemTag info = new ItemTag(" test ");
         Assert.assertEquals(info.getTag(), "test");
 
@@ -34,9 +35,13 @@ public class ItemTagTest {
         } catch (ConstraintViolationException e) {
             // expected this
         }
-
+    }
+    
+    @SuppressWarnings("null")
+    @Test
+    public void testNull() {
         try {
-            info = new ItemTag(null);
+            new ItemTag(null);
         } catch (ConstraintViolationException e) {
             // expected this
         }
diff --git a/mda-framework/src/test/java/net/shibboleth/metadata/MockItem.java b/mda-framework/src/test/java/net/shibboleth/metadata/MockItem.java
index cc58622..09889a3 100644
--- a/mda-framework/src/test/java/net/shibboleth/metadata/MockItem.java
+++ b/mda-framework/src/test/java/net/shibboleth/metadata/MockItem.java
@@ -19,6 +19,7 @@ package net.shibboleth.metadata;
 
 import java.util.Objects;
 
+import javax.annotation.Nonnull;
 import javax.annotation.concurrent.NotThreadSafe;
 
 /** A mock implementation of {@link Item}. */
@@ -30,12 +31,12 @@ public class MockItem extends AbstractItem<String> {
      * 
      * @param str data held by this item
      */
-    public MockItem(String str) {
+    public MockItem(@Nonnull String str) {
         super(str);
     }
 
     @Override
-    public Item<String> copy() {
+    public @Nonnull Item<String> copy() {
         final MockItem clone = new MockItem(new String(unwrap()));
         clone.getItemMetadata().putAll(getItemMetadata());
         return clone;
diff --git a/mda-framework/src/test/java/net/shibboleth/metadata/SimpleItemCollectionSerializerTest.java b/mda-framework/src/test/java/net/shibboleth/metadata/SimpleItemCollectionSerializerTest.java
index 31f5d39..193a801 100644
--- a/mda-framework/src/test/java/net/shibboleth/metadata/SimpleItemCollectionSerializerTest.java
+++ b/mda-framework/src/test/java/net/shibboleth/metadata/SimpleItemCollectionSerializerTest.java
@@ -23,6 +23,8 @@ import java.io.OutputStream;
 import java.util.ArrayList;
 import java.util.List;
 
+import javax.annotation.Nonnull;
+
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
@@ -40,7 +42,7 @@ public class SimpleItemCollectionSerializerTest {
         final ByteArrayOutputStream output = new ByteArrayOutputStream();
         final var base = new ItemSerializer<String>() {
             @Override
-            public void serialize(Item<String> item, OutputStream out) {
+            public void serialize(@Nonnull Item<String> item, @Nonnull OutputStream out) {
                 try {
                     out.write(item.unwrap().getBytes());
                 } catch (IOException e) {
diff --git a/mda-framework/src/test/java/net/shibboleth/metadata/dom/StringAttributeValidationStageTest.java b/mda-framework/src/test/java/net/shibboleth/metadata/dom/StringAttributeValidationStageTest.java
index 084f832..8c55dca 100644
--- a/mda-framework/src/test/java/net/shibboleth/metadata/dom/StringAttributeValidationStageTest.java
+++ b/mda-framework/src/test/java/net/shibboleth/metadata/dom/StringAttributeValidationStageTest.java
@@ -3,7 +3,6 @@ package net.shibboleth.metadata.dom;
 
 import java.util.ArrayList;
 import java.util.HashSet;
-import java.util.Set;
 
 import javax.xml.namespace.QName;
 
@@ -17,6 +16,7 @@ import net.shibboleth.metadata.dom.saml.SAMLMetadataSupport;
 import net.shibboleth.metadata.validate.RejectAllValidator;
 import net.shibboleth.metadata.validate.Validator;
 import net.shibboleth.metadata.validate.testing.CollectingValidator;
+import net.shibboleth.shared.collection.CollectionSupport;
 import net.shibboleth.shared.component.ComponentInitializationException;
 import net.shibboleth.shared.xml.XMLConstants;
 
@@ -56,7 +56,7 @@ public class StringAttributeValidationStageTest extends BaseDOMTest {
         Assert.assertEquals(qname.size(), 1);
         Assert.assertEquals(qname.iterator().next(), new QName("a", "b"));
         // Collection of unqualified names
-        stage.setAttributeNames(Set.of("one", "two", "three"));
+        stage.setAttributeNames(CollectionSupport.setOf("one", "two", "three"));
         var qnames = stage.getAttributeNames();
         Assert.assertEquals(qnames.size(), 3);
         Assert.assertTrue(qnames.contains(new QName("one")));
diff --git a/mda-framework/src/test/java/net/shibboleth/metadata/dom/StringElementValidationStageTest.java b/mda-framework/src/test/java/net/shibboleth/metadata/dom/StringElementValidationStageTest.java
index 5d68a3b..75a4b8c 100644
--- a/mda-framework/src/test/java/net/shibboleth/metadata/dom/StringElementValidationStageTest.java
+++ b/mda-framework/src/test/java/net/shibboleth/metadata/dom/StringElementValidationStageTest.java
@@ -4,6 +4,7 @@ package net.shibboleth.metadata.dom;
 import java.util.ArrayList;
 import java.util.List;
 
+import javax.annotation.Nonnull;
 import javax.xml.namespace.QName;
 
 import org.testng.Assert;
@@ -17,6 +18,7 @@ import net.shibboleth.metadata.dom.saml.SAMLMetadataSupport;
 import net.shibboleth.metadata.validate.RejectAllValidator;
 import net.shibboleth.metadata.validate.Validator;
 import net.shibboleth.metadata.validate.string.AcceptStringRegexValidator;
+import net.shibboleth.shared.collection.CollectionSupport;
 import net.shibboleth.shared.component.ComponentInitializationException;
 
 public class StringElementValidationStageTest extends BaseDOMTest {
@@ -73,7 +75,7 @@ public class StringElementValidationStageTest extends BaseDOMTest {
         stop.setId("stop");
         stop.initialize();
         
-        final List<Validator<String>> validators = List.of(val, stop);
+        final @Nonnull List<Validator<String>> validators = CollectionSupport.listOf(val, stop);
       
         final StringElementValidationStage stage = new StringElementValidationStage();
         stage.setId("test");
@@ -100,9 +102,9 @@ public class StringElementValidationStageTest extends BaseDOMTest {
         
         final StringElementValidationStage stage = new StringElementValidationStage();
         stage.setId("test");
-        stage.setElementNames(List.of(SAMLMetadataSupport.ORGANIZATIONNAME_NAME,
+        stage.setElementNames(CollectionSupport.listOf(SAMLMetadataSupport.ORGANIZATIONNAME_NAME,
                 SAMLMetadataSupport.ORGANIZATIONDISPLAYNAME_NAME));
-        stage.setValidators(List.of(stop)); // reject everything
+        stage.setValidators(CollectionSupport.listOf(stop)); // reject everything
         stage.initialize();
       
         stage.execute(items);
diff --git a/mda-framework/src/test/java/net/shibboleth/metadata/dom/WhitespaceTrimmingVisitorTest.java b/mda-framework/src/test/java/net/shibboleth/metadata/dom/WhitespaceTrimmingVisitorTest.java
index 551721f..25ef899 100644
--- a/mda-framework/src/test/java/net/shibboleth/metadata/dom/WhitespaceTrimmingVisitorTest.java
+++ b/mda-framework/src/test/java/net/shibboleth/metadata/dom/WhitespaceTrimmingVisitorTest.java
@@ -41,6 +41,7 @@ public class WhitespaceTrimmingVisitorTest extends BaseDOMTest {
         final ParserPool parserPool = getParserPool();
         final DocumentBuilder builder = parserPool.getBuilder();
         final Document document = builder.newDocument();
+        assert document != null;
         final Element element = ElementSupport.constructElement(document,
                 SAMLMetadataSupport.ENTITY_DESCRIPTOR_NAME);
         ElementSupport.setDocumentElement(document, element);
diff --git a/mda-framework/src/test/java/net/shibboleth/metadata/dom/ds/X509ValidationStageTest.java b/mda-framework/src/test/java/net/shibboleth/metadata/dom/ds/X509ValidationStageTest.java
index 00d1efa..dd87b30 100644
--- a/mda-framework/src/test/java/net/shibboleth/metadata/dom/ds/X509ValidationStageTest.java
+++ b/mda-framework/src/test/java/net/shibboleth/metadata/dom/ds/X509ValidationStageTest.java
@@ -23,6 +23,8 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
+import javax.annotation.Nonnull;
+
 import net.shibboleth.metadata.ErrorStatus;
 import net.shibboleth.metadata.Item;
 import net.shibboleth.metadata.WarningStatus;
@@ -49,7 +51,7 @@ public class X509ValidationStageTest extends BaseDOMTest {
         return stage; 
     }
     
-    private DOMElementItem makeItem(final String which) throws XMLParserException {
+    private DOMElementItem makeItem(final @Nonnull String which) throws XMLParserException {
         final Element doc = readXMLData(classRelativeResource(which));
         return new DOMElementItem(doc);
     }
diff --git a/mda-framework/src/test/java/net/shibboleth/metadata/dom/saml/AttributeElementMatcherTest.java b/mda-framework/src/test/java/net/shibboleth/metadata/dom/saml/AttributeElementMatcherTest.java
index 0856dfc..2f226e5 100644
--- a/mda-framework/src/test/java/net/shibboleth/metadata/dom/saml/AttributeElementMatcherTest.java
+++ b/mda-framework/src/test/java/net/shibboleth/metadata/dom/saml/AttributeElementMatcherTest.java
@@ -1,6 +1,8 @@
 
 package net.shibboleth.metadata.dom.saml;
 
+import javax.annotation.Nonnull;
+
 import org.testng.Assert;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
@@ -12,7 +14,7 @@ import net.shibboleth.shared.xml.ElementSupport;
 
 public class AttributeElementMatcherTest extends BaseDOMTest {
 
-    private final Document doc;
+    private final @Nonnull Document doc;
     private Element attr;
 
     protected AttributeElementMatcherTest() throws Exception {
@@ -29,14 +31,17 @@ public class AttributeElementMatcherTest extends BaseDOMTest {
     @Test
     public void matchNormal() throws Exception {
         final var matcher1 = new AttributeElementMatcher("name", "name-format");
+        assert attr != null;
         attr.setAttribute("Name", "name");
         attr.setAttribute("NameFormat", "name-format");
         Assert.assertTrue(matcher1.match(attr));
 
         final var matcher2 = new AttributeElementMatcher("name2", "name-format");
+        assert attr != null;
         Assert.assertFalse(matcher2.match(attr));
 
         final var matcher3 = new AttributeElementMatcher("name", "name-format2");
+        assert attr != null;
         Assert.assertFalse(matcher3.match(attr));
     }
 
@@ -45,9 +50,11 @@ public class AttributeElementMatcherTest extends BaseDOMTest {
         attr.setAttribute("Name", "name");
 
         final var matcher1 = new AttributeElementMatcher("name", SAMLSupport.ATTRNAME_FORMAT_UNSPECIFIED);
+        assert attr != null;
         Assert.assertTrue(matcher1.match(attr));
 
         final var matcher2 = new AttributeElementMatcher("name2", SAMLSupport.ATTRNAME_FORMAT_UNSPECIFIED);
+        assert attr != null;
         Assert.assertFalse(matcher2.match(attr));
     }
 
diff --git a/mda-framework/src/test/java/net/shibboleth/metadata/dom/saml/AttributeValueElementMakerTest.java b/mda-framework/src/test/java/net/shibboleth/metadata/dom/saml/AttributeValueElementMakerTest.java
index 2c8b497..19336b1 100644
--- a/mda-framework/src/test/java/net/shibboleth/metadata/dom/saml/AttributeValueElementMakerTest.java
+++ b/mda-framework/src/test/java/net/shibboleth/metadata/dom/saml/AttributeValueElementMakerTest.java
@@ -23,6 +23,7 @@ public class AttributeValueElementMakerTest extends BaseDOMTest {
     public void apply() {
         final var maker = new AttributeValueElementMaker("value text");
         final Element root = doc.createElementNS("ns", "root");
+        assert root != null;
         final Container rootContainer = new Container(root);
         final Element newElement = maker.make(rootContainer);
         Assert.assertNotNull(newElement);
diff --git a/mda-framework/src/test/java/net/shibboleth/metadata/dom/saml/GenerateIdStageTest.java b/mda-framework/src/test/java/net/shibboleth/metadata/dom/saml/GenerateIdStageTest.java
index dd31089..4eb29ae 100644
--- a/mda-framework/src/test/java/net/shibboleth/metadata/dom/saml/GenerateIdStageTest.java
+++ b/mda-framework/src/test/java/net/shibboleth/metadata/dom/saml/GenerateIdStageTest.java
@@ -32,6 +32,7 @@ import net.shibboleth.metadata.dom.BaseDOMTest;
 import net.shibboleth.metadata.dom.DOMElementItem;
 import net.shibboleth.metadata.util.FixedStringIdentifierGenerationStrategy;
 import net.shibboleth.shared.xml.impl.BasicParserPool;
+import net.shibboleth.shared.collection.CollectionSupport;
 import net.shibboleth.shared.xml.ElementSupport;
 
 import org.testng.Assert;
@@ -109,7 +110,7 @@ public class GenerateIdStageTest extends BaseDOMTest {
         
         final var item = readDOMItem("in.xml");
         
-        stage.execute(List.of(item));
+        stage.execute(CollectionSupport.listOf(item));
         
         stage.destroy();
         
@@ -126,7 +127,7 @@ public class GenerateIdStageTest extends BaseDOMTest {
         
         final var item = readDOMItem("notentity.xml");
         
-        stage.execute(List.of(item));
+        stage.execute(CollectionSupport.listOf(item));
         
         stage.destroy();
         
diff --git a/mda-framework/src/test/java/net/shibboleth/metadata/dom/saml/PullUpCacheDurationStageTest.java b/mda-framework/src/test/java/net/shibboleth/metadata/dom/saml/PullUpCacheDurationStageTest.java
index 8ae3ac7..b2db84f 100644
--- a/mda-framework/src/test/java/net/shibboleth/metadata/dom/saml/PullUpCacheDurationStageTest.java
+++ b/mda-framework/src/test/java/net/shibboleth/metadata/dom/saml/PullUpCacheDurationStageTest.java
@@ -69,6 +69,7 @@ public class PullUpCacheDurationStageTest extends BaseDOMTest {
         Assert.assertEquals(entityDescriptors.size(), 3);
 
         for (Element entityDescriptor : entityDescriptors) {
+            assert entityDescriptor != null;
             Assert.assertFalse(AttributeSupport.hasAttribute(entityDescriptor,
                     SAMLMetadataSupport.CACHE_DURATION_ATTRIB_NAME));
         }
diff --git a/mda-framework/src/test/java/net/shibboleth/metadata/dom/saml/RemoveOrganizationStageTest.java b/mda-framework/src/test/java/net/shibboleth/metadata/dom/saml/RemoveOrganizationStageTest.java
index b84fa2a..d3c2277 100644
--- a/mda-framework/src/test/java/net/shibboleth/metadata/dom/saml/RemoveOrganizationStageTest.java
+++ b/mda-framework/src/test/java/net/shibboleth/metadata/dom/saml/RemoveOrganizationStageTest.java
@@ -48,6 +48,7 @@ public class RemoveOrganizationStageTest extends BaseDOMTest {
         List<Element> descriptors = ElementSupport
                 .getChildElements(readXMLData("in.xml"));
         for (Element descriptor : descriptors) {
+            assert descriptor != null;
             metadataCollection.add(new DOMElementItem(descriptor));
         }
 
@@ -83,6 +84,7 @@ public class RemoveOrganizationStageTest extends BaseDOMTest {
         Element entitiesDescriptor = metadataCollection.get(0).unwrap();
         List<Element> entityDescriptors = ElementSupport.getChildElements(entitiesDescriptor);
         for (Element entityDescriptor : entityDescriptors) {
+            assert entityDescriptor != null;
             Assert.assertFalse(ElementSupport.getChildElementsByTagNameNS(entityDescriptor, SAMLMetadataSupport.MD_NS,
                     "Organization").isEmpty());
         }
@@ -96,6 +98,7 @@ public class RemoveOrganizationStageTest extends BaseDOMTest {
         Assert.assertEquals(metadataCollection.size(), 1);
 
         for (Element entityDescriptor : entityDescriptors) {
+            assert entityDescriptor != null;
             Assert.assertTrue(ElementSupport.getChildElementsByTagNameNS(entityDescriptor, SAMLMetadataSupport.MD_NS,
                     "Organization").isEmpty());
         }
diff --git a/mda-framework/src/test/java/net/shibboleth/metadata/dom/saml/SAMLStringElementCheckingStageTest.java b/mda-framework/src/test/java/net/shibboleth/metadata/dom/saml/SAMLStringElementCheckingStageTest.java
index a280d63..c658cdc 100644
--- a/mda-framework/src/test/java/net/shibboleth/metadata/dom/saml/SAMLStringElementCheckingStageTest.java
+++ b/mda-framework/src/test/java/net/shibboleth/metadata/dom/saml/SAMLStringElementCheckingStageTest.java
@@ -3,7 +3,6 @@ package net.shibboleth.metadata.dom.saml;
 
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Set;
 
 import org.testng.Assert;
 import org.testng.annotations.Test;
@@ -13,6 +12,7 @@ import net.shibboleth.metadata.ErrorStatus;
 import net.shibboleth.metadata.Item;
 import net.shibboleth.metadata.dom.BaseDOMTest;
 import net.shibboleth.metadata.dom.DOMElementItem;
+import net.shibboleth.shared.collection.CollectionSupport;
 
 public class SAMLStringElementCheckingStageTest extends BaseDOMTest {
 
@@ -29,7 +29,7 @@ public class SAMLStringElementCheckingStageTest extends BaseDOMTest {
         
         final SAMLStringElementCheckingStage stage = new SAMLStringElementCheckingStage();
         stage.setId("test");
-        stage.setElementNames(Set.of(SAMLMetadataSupport.ORGANIZATIONNAME_NAME));
+        stage.setElementNames(CollectionSupport.setOf(SAMLMetadataSupport.ORGANIZATIONNAME_NAME));
         stage.initialize();
         
         stage.execute(items);
@@ -48,7 +48,7 @@ public class SAMLStringElementCheckingStageTest extends BaseDOMTest {
         
         final SAMLStringElementCheckingStage stage = new SAMLStringElementCheckingStage();
         stage.setId("test");
-        stage.setElementNames(Set.of(SAMLMetadataSupport.ORGANIZATIONNAME_NAME,
+        stage.setElementNames(CollectionSupport.setOf(SAMLMetadataSupport.ORGANIZATIONNAME_NAME,
                 SAMLMetadataSupport.ORGANIZATIONDISPLAYNAME_NAME));
         stage.initialize();
         
diff --git a/mda-framework/src/test/java/net/shibboleth/metadata/dom/saml/SetCacheDurationStageTest.java b/mda-framework/src/test/java/net/shibboleth/metadata/dom/saml/SetCacheDurationStageTest.java
index 055e104..b0541b9 100644
--- a/mda-framework/src/test/java/net/shibboleth/metadata/dom/saml/SetCacheDurationStageTest.java
+++ b/mda-framework/src/test/java/net/shibboleth/metadata/dom/saml/SetCacheDurationStageTest.java
@@ -21,6 +21,7 @@ import java.time.Duration;
 import java.util.ArrayList;
 import java.util.Date;
 
+import javax.annotation.Nonnull;
 import javax.xml.datatype.DatatypeConfigurationException;
 import javax.xml.datatype.DatatypeFactory;
 
@@ -53,7 +54,7 @@ public class SetCacheDurationStageTest extends BaseDOMTest {
      * @return the cache duration attribute value converted to a {@link Duration}
      * @throws DatatypeConfigurationException if a {@link DatatypeFactory} can't be constructed
      */
-    private Duration fetchDuration(Element descriptor) throws DatatypeConfigurationException {
+    private Duration fetchDuration(@Nonnull Element descriptor) throws DatatypeConfigurationException {
         final Date baseDate = new Date(0);
         final DatatypeFactory dtf = DatatypeFactory.newInstance();
         final Attr cacheDurationAttr = AttributeSupport.getAttribute(descriptor,
@@ -78,6 +79,7 @@ public class SetCacheDurationStageTest extends BaseDOMTest {
         metadataCollection.add(item);
 
         final var duration = Duration.ofMillis(123456);
+        assert duration != null;
         SetCacheDurationStage stage = new SetCacheDurationStage();
         stage.setId("test");
         stage.setCacheDuration(duration);
@@ -99,6 +101,7 @@ public class SetCacheDurationStageTest extends BaseDOMTest {
         final Item<Element> item = new DOMElementItem(entitiesDescriptor);
         
         final var originalDuration = Duration.ofMillis(987654);
+        assert originalDuration != null;
         AttributeSupport.appendDurationAttribute(entitiesDescriptor, SAMLMetadataSupport.CACHE_DURATION_ATTRIB_NAME,
                 originalDuration);
 
@@ -109,6 +112,7 @@ public class SetCacheDurationStageTest extends BaseDOMTest {
         metadataCollection.add(item);
 
         final var duration = Duration.ofMillis(123456);
+        assert duration != null;
         SetCacheDurationStage stage = new SetCacheDurationStage();
         stage.setId("test");
         stage.setCacheDuration(duration);
@@ -131,12 +135,14 @@ public class SetCacheDurationStageTest extends BaseDOMTest {
 
         Document newDoc = parserPool.newDocument();
         Element root = newDoc.createElementNS("http://example.org", "foo");
+        assert root != null;
         ElementSupport.setDocumentElement(newDoc, root);
 
         final ArrayList<Item<Element>> metadataCollection = new ArrayList<>();
         metadataCollection.add(new DOMElementItem(root));
 
         final var duration = Duration.ofMillis(123456);
+        assert duration != null;
         SetCacheDurationStage stage = new SetCacheDurationStage();
         stage.setId("test");
         stage.setCacheDuration(duration);
@@ -155,7 +161,9 @@ public class SetCacheDurationStageTest extends BaseDOMTest {
         stage.setId("test");
 
         try {
-            stage.setCacheDuration(Duration.ofMillis(-987654));
+            final var duration = Duration.ofMillis(-987654);
+            assert duration != null;
+            stage.setCacheDuration(duration);
             Assert.fail();
         } catch (ConstraintViolationException e) {
             // expected this
@@ -169,7 +177,9 @@ public class SetCacheDurationStageTest extends BaseDOMTest {
         stage.setId("test");
 
         try {
-            stage.setCacheDuration(Duration.ZERO);
+            final var duration = Duration.ZERO;
+            assert duration != null;
+            stage.setCacheDuration(duration);
             Assert.fail();
         } catch (ConstraintViolationException e) {
             // expected this
@@ -177,6 +187,7 @@ public class SetCacheDurationStageTest extends BaseDOMTest {
     }
 
     /** Tests that the stage properly rejects null durations. */
+    @SuppressWarnings("null")
     @Test
     public void testNullDuration() {
         final var stage = new SetCacheDurationStage();
@@ -190,4 +201,4 @@ public class SetCacheDurationStageTest extends BaseDOMTest {
         }
     }
 
-}
\ No newline at end of file
+}
diff --git a/mda-framework/src/test/java/net/shibboleth/metadata/dom/saml/SetValidUntilStageTest.java b/mda-framework/src/test/java/net/shibboleth/metadata/dom/saml/SetValidUntilStageTest.java
index 3f6555b..03357b2 100644
--- a/mda-framework/src/test/java/net/shibboleth/metadata/dom/saml/SetValidUntilStageTest.java
+++ b/mda-framework/src/test/java/net/shibboleth/metadata/dom/saml/SetValidUntilStageTest.java
@@ -60,6 +60,7 @@ public class SetValidUntilStageTest extends BaseDOMTest {
         metadataCollection.add(new DOMElementItem(entitiesDescriptor));
 
         final var duration = Duration.ofMillis(123456);
+        assert duration != null;
         final var now = Instant.now();
         SetValidUntilStage stage = new SetValidUntilStage();
         stage.setId("test");
@@ -92,6 +93,7 @@ public class SetValidUntilStageTest extends BaseDOMTest {
         metadataCollection.add(new DOMElementItem(entitiesDescriptor));
 
         final var duration = Duration.ofMillis(123456);
+        assert duration != null;
         final var now = Instant.now();
         SetValidUntilStage stage = new SetValidUntilStage();
         stage.setId("test");
@@ -121,12 +123,14 @@ public class SetValidUntilStageTest extends BaseDOMTest {
 
         Document newDoc = parserPool.newDocument();
         Element root = newDoc.createElementNS("http://example.org", "foo");
+        assert root != null;
         ElementSupport.setDocumentElement(newDoc, root);
 
         final ArrayList<Item<Element>> metadataCollection = new ArrayList<>();
         metadataCollection.add(new DOMElementItem(root));
 
         final var duration = Duration.ofMillis(123456);
+        assert duration != null;
         SetValidUntilStage stage = new SetValidUntilStage();
         stage.setId("test");
         stage.setValidityDuration(duration);
@@ -143,6 +147,7 @@ public class SetValidUntilStageTest extends BaseDOMTest {
     public void testNegativeDuration() {
 
         final var duration = Duration.ofMillis(-987654);
+        assert duration != null;
         SetValidUntilStage stage = new SetValidUntilStage();
         stage.setId("test");
 
@@ -161,7 +166,9 @@ public class SetValidUntilStageTest extends BaseDOMTest {
         stage.setId("test");
 
         try {
-            stage.setValidityDuration(Duration.ZERO);
+            final var duration = Duration.ZERO;
+            assert duration != null;
+            stage.setValidityDuration(duration);
             Assert.fail();
         } catch (ConstraintViolationException e) {
             // expected this
@@ -169,6 +176,7 @@ public class SetValidUntilStageTest extends BaseDOMTest {
     }
 
     /** Tests that the stage properly rejects null durations. */
+    @SuppressWarnings("null")
     @Test
     public void testNullDuration() {
         final var stage = new SetValidUntilStage();
diff --git a/mda-framework/src/test/java/net/shibboleth/metadata/dom/saml/ValidateValidUntilStageTest.java b/mda-framework/src/test/java/net/shibboleth/metadata/dom/saml/ValidateValidUntilStageTest.java
index 9b195b6..6def451 100644
--- a/mda-framework/src/test/java/net/shibboleth/metadata/dom/saml/ValidateValidUntilStageTest.java
+++ b/mda-framework/src/test/java/net/shibboleth/metadata/dom/saml/ValidateValidUntilStageTest.java
@@ -100,14 +100,19 @@ public class ValidateValidUntilStageTest extends BaseDOMTest {
      * 
      * @throws Exception if something bad happens
      */
-    private DOMElementItem buildDomElementItem(@Nonnull final Duration validUntilInterval) throws Exception {
+    private @Nonnull DOMElementItem buildDomElementItem(final Duration validUntilInterval) throws Exception {
+        assert validUntilInterval != null;
         Element descriptor = readXMLData("in.xml");
         if (!validUntilInterval.isZero()) {
+            final var when = Instant.now().plus(validUntilInterval);
+            assert when != null;
             AttributeSupport.appendDateTimeAttribute(descriptor, SAMLMetadataSupport.VALID_UNTIL_ATTRIB_NAME,
-                    Instant.now().plus(validUntilInterval));
+                    when);
         }else{
             AttributeSupport.removeAttribute(descriptor, SAMLMetadataSupport.VALID_UNTIL_ATTRIB_NAME);
         }
-        return new DOMElementItem(descriptor.getOwnerDocument());
+        final var doc = descriptor.getOwnerDocument();
+        assert doc != null;
+        return new DOMElementItem(doc);
     }
 }
diff --git a/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/FilesInDirectoryMultiOutputStrategyTest.java b/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/FilesInDirectoryMultiOutputStrategyTest.java
index f17a329..918c495 100644
--- a/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/FilesInDirectoryMultiOutputStrategyTest.java
+++ b/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/FilesInDirectoryMultiOutputStrategyTest.java
@@ -49,6 +49,7 @@ public class FilesInDirectoryMultiOutputStrategyTest {
     // Test with a prefix, a suffix, and an ID transform that doubles the name
     @Test public void testFull() throws Exception {
         final File tempDir = Files.createTempDirectory("FilesInDirectoryMultiOutputStrategyTest").toFile();
+        assert tempDir != null;
         //System.out.println("temp dir: " + tempDir.getAbsolutePath());
         
         final FilesInDirectoryMultiOutputStrategy<String> strategy = new FilesInDirectoryMultiOutputStrategy<>();
@@ -79,6 +80,7 @@ public class FilesInDirectoryMultiOutputStrategyTest {
     // Test with defaults
     @Test public void testDefaults() throws Exception {
         final File tempDir = Files.createTempDirectory("FilesInDirectoryMultiOutputStrategyTest").toFile();
+        assert tempDir != null;
         //System.out.println("temp dir: " + tempDir.getAbsolutePath());
 
         final FilesInDirectoryMultiOutputStrategy<String> strategy = new FilesInDirectoryMultiOutputStrategy<>();
diff --git a/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/ItemIdTransformStageTest.java b/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/ItemIdTransformStageTest.java
index 99efec6..b5daaf7 100644
--- a/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/ItemIdTransformStageTest.java
+++ b/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/ItemIdTransformStageTest.java
@@ -27,6 +27,7 @@ import org.testng.annotations.Test;
 import net.shibboleth.metadata.Item;
 import net.shibboleth.metadata.ItemId;
 import net.shibboleth.metadata.MockItem;
+import net.shibboleth.shared.collection.CollectionSupport;
 
 public class ItemIdTransformStageTest {
 
@@ -86,11 +87,11 @@ public class ItemIdTransformStageTest {
         Assert.assertEquals(stage.getIdTransformers().size(), 0);
         
         // Put in a list of one thing.
-        stage.setIdTransformers(List.of(new MDQueryMD5ItemIdTransformer()));
+        stage.setIdTransformers(CollectionSupport.listOf(new MDQueryMD5ItemIdTransformer()));
         Assert.assertEquals(stage.getIdTransformers().size(), 1);
         
         // Put in a list of one other thing
-        stage.setIdTransformers(List.of(new MDQuerySHA1ItemIdTransformer()));
+        stage.setIdTransformers(CollectionSupport.listOf(new MDQuerySHA1ItemIdTransformer()));
         // Should still be one thing, not accumulated to two
         Assert.assertEquals(stage.getIdTransformers().size(), 1);
         // Should also be the new thing, not the old thing.
diff --git a/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/PipelineDemultiplexerStageTest.java b/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/PipelineDemultiplexerStageTest.java
index 1bed8f3..5b09e94 100644
--- a/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/PipelineDemultiplexerStageTest.java
+++ b/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/PipelineDemultiplexerStageTest.java
@@ -18,21 +18,21 @@
 package net.shibboleth.metadata.pipeline;
 
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.function.Predicate;
 
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
 import net.shibboleth.metadata.Item;
 import net.shibboleth.metadata.MockItem;
 import net.shibboleth.metadata.SimpleItemCollectionFactory;
+import net.shibboleth.shared.collection.CollectionSupport;
 import net.shibboleth.shared.collection.Pair;
 import net.shibboleth.shared.component.ComponentInitializationException;
 
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
 /** Unit test of {@link PipelineDemultiplexerStage}. */
 public class PipelineDemultiplexerStageTest {
 
@@ -44,10 +44,12 @@ public class PipelineDemultiplexerStageTest {
         Assert.assertEquals(stage.getCollectionFactory(), factory);
     }
 
+    @SuppressWarnings("removal")
     @Test public void testExecutorService() {
         PipelineDemultiplexerStage<Object> stage = new PipelineDemultiplexerStage<>();
 
         ExecutorService executor = Executors.newSingleThreadExecutor();
+        assert executor != null;
         stage.setExecutorService(executor);
         Assert.assertEquals(stage.getExecutorService(), executor);
     }
@@ -56,6 +58,7 @@ public class PipelineDemultiplexerStageTest {
         PipelineDemultiplexerStage<Object> stage = new PipelineDemultiplexerStage<>();
 
         ExecutorService executor = Executors.newSingleThreadExecutor();
+        assert executor != null;
         stage.setExecutor(executor);
         Assert.assertEquals(stage.getExecutor(), executor);
     }
@@ -83,11 +86,11 @@ public class PipelineDemultiplexerStageTest {
 
         stage = new PipelineDemultiplexerStage<>();
         stage.setId("test");
-        stage.setPipelineAndSelectionStrategies(Collections.singletonList(new Pair<Pipeline<String>, Predicate<Item<String>>>(pipeline,
+        stage.setPipelineAndSelectionStrategies(CollectionSupport.listOf(new Pair<Pipeline<String>, Predicate<Item<String>>>(pipeline,
                 x -> true)));
         stage.initialize();
         Assert.assertNotNull(stage.getCollectionFactory());
-        Assert.assertNotNull(stage.getExecutorService());
+        Assert.assertNotNull(stage.getExecutor());
 
         try {
             stage = new PipelineDemultiplexerStage<>();
@@ -103,7 +106,7 @@ public class PipelineDemultiplexerStageTest {
         SimplePipeline<String> pipeline = new SimplePipeline<>();
         pipeline.setId("selectedPipeline");
         CountingStage<String> countStage = new CountingStage<>();
-        pipeline.setStages(Collections.<Stage<String>>singletonList(countStage));
+        pipeline.setStages(CollectionSupport.<Stage<String>>listOf(countStage));
 
         final List<Item<String>> items = new ArrayList<>();
         items.add(new MockItem("one"));
@@ -113,7 +116,7 @@ public class PipelineDemultiplexerStageTest {
         PipelineDemultiplexerStage<String> stage = new PipelineDemultiplexerStage<>();
         stage.setId("test");
         stage.setWaitingForPipelines(true);
-        stage.setPipelineAndSelectionStrategies(Collections.singletonList(new Pair<Pipeline<String>, Predicate<Item<String>>>(pipeline,
+        stage.setPipelineAndSelectionStrategies(CollectionSupport.listOf(new Pair<Pipeline<String>, Predicate<Item<String>>>(pipeline,
                 x -> true)));
         stage.initialize();
 
@@ -127,7 +130,7 @@ public class PipelineDemultiplexerStageTest {
         final SimplePipeline<String> pipeline = new SimplePipeline<>();
         pipeline.setId("selectedPipeline");
         final TerminatingStage<String> terminatingStage = new TerminatingStage<>();
-        pipeline.setStages(Collections.<Stage<String>>singletonList(terminatingStage));
+        pipeline.setStages(CollectionSupport.<Stage<String>>listOf(terminatingStage));
 
         final List<Item<String>> items = new ArrayList<>();
         items.add(new MockItem("one"));
@@ -137,7 +140,7 @@ public class PipelineDemultiplexerStageTest {
         PipelineDemultiplexerStage<String> stage = new PipelineDemultiplexerStage<>();
         stage.setId("test");
         stage.setWaitingForPipelines(true);
-        stage.setPipelineAndSelectionStrategies(Collections.singletonList(new Pair<Pipeline<String>, Predicate<Item<String>>>(pipeline,
+        stage.setPipelineAndSelectionStrategies(CollectionSupport.listOf(new Pair<Pipeline<String>, Predicate<Item<String>>>(pipeline,
                 x -> true)));
         stage.initialize();
 
diff --git a/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/ScriptletStageTest.java b/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/ScriptletStageTest.java
index f63f210..b7fac92 100644
--- a/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/ScriptletStageTest.java
+++ b/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/ScriptletStageTest.java
@@ -1,8 +1,6 @@
 
 package net.shibboleth.metadata.pipeline;
 
-import java.util.List;
-
 import javax.script.Compilable;
 import javax.script.ScriptEngineManager;
 
@@ -14,6 +12,7 @@ import net.shibboleth.metadata.BaseTest;
 import net.shibboleth.metadata.Item;
 import net.shibboleth.metadata.MockItem;
 import net.shibboleth.metadata.TestMarker;
+import net.shibboleth.shared.collection.CollectionSupport;
 import net.shibboleth.shared.component.ComponentInitializationException;
 import net.shibboleth.shared.scripting.EvaluableScript;
 
@@ -59,7 +58,7 @@ public class ScriptletStageTest extends BaseTest {
         stage.setScript(script);
         stage.initialize();
 
-        final var items = List.<Item<String>>of(new MockItem("one"), new MockItem("two"));
+        final var items = CollectionSupport.<Item<String>>listOf(new MockItem("one"), new MockItem("two"));
         stage.execute(items);
 
         // The script should have added a TestMarker to each item.
@@ -91,7 +90,7 @@ public class ScriptletStageTest extends BaseTest {
         stage.setScript(script);
         stage.initialize();
         
-        final var items = List.<Item<String>>of(new MockItem("one"), new MockItem("two"));
+        final var items = CollectionSupport.<Item<String>>listOf(new MockItem("one"), new MockItem("two"));
         
         try {
             stage.execute(items);
@@ -129,7 +128,7 @@ public class ScriptletStageTest extends BaseTest {
         stage.setVariableName("$items");
         stage.initialize();
         
-        final var items = List.<Item<String>>of(new MockItem("one"), new MockItem("two"));
+        final var items = CollectionSupport.<Item<String>>listOf(new MockItem("one"), new MockItem("two"));
         stage.execute(items);
         
         // The script should have added a TestMarker to each item.
@@ -162,7 +161,7 @@ public class ScriptletStageTest extends BaseTest {
         stage.setScript(script);
         stage.initialize();
         
-        final var items = List.<Item<String>>of(new MockItem("one"), new MockItem("two"));
+        final var items = CollectionSupport.<Item<String>>listOf(new MockItem("one"), new MockItem("two"));
         stage.execute(items);
         
         // The script should have added a TestMarker to each item.
diff --git a/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/SerializationStageTest.java b/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/SerializationStageTest.java
index 3e4de41..469b423 100644
--- a/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/SerializationStageTest.java
+++ b/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/SerializationStageTest.java
@@ -7,7 +7,8 @@ import java.io.OutputStream;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.util.Collection;
-import java.util.List;
+
+import javax.annotation.Nonnull;
 
 import org.testng.Assert;
 import org.testng.annotations.Test;
@@ -15,13 +16,15 @@ import org.testng.annotations.Test;
 import net.shibboleth.metadata.Item;
 import net.shibboleth.metadata.ItemCollectionSerializer;
 import net.shibboleth.metadata.MockItem;
+import net.shibboleth.shared.collection.CollectionSupport;
 import net.shibboleth.shared.component.ComponentInitializationException;
 
 public class SerializationStageTest {
     
     private static class StringSerializer implements ItemCollectionSerializer<String> {
 
-        public void serializeCollection(Collection<Item<String>> items, OutputStream output) throws IOException {
+        public void serializeCollection(@Nonnull Collection<Item<String>> items,
+                @Nonnull OutputStream output) throws IOException {
             for (final var item : items) {
                 output.write(item.unwrap().getBytes(StandardCharsets.UTF_8));
                 output.write('\n');
@@ -44,7 +47,7 @@ public class SerializationStageTest {
             stage.setSerializer(new StringSerializer());
             stage.initialize();
             
-            stage.execute(List.of(new MockItem("one"), new MockItem("two")));
+            stage.execute(CollectionSupport.listOf(new MockItem("one"), new MockItem("two")));
 
             // Read the file back in.
             var text = Files.readString(path);
diff --git a/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/SplitMergeStageTest.java b/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/SplitMergeStageTest.java
index c6f9db5..d36f555 100644
--- a/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/SplitMergeStageTest.java
+++ b/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/SplitMergeStageTest.java
@@ -18,20 +18,20 @@
 package net.shibboleth.metadata.pipeline;
 
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.function.Predicate;
 
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
 import net.shibboleth.metadata.Item;
 import net.shibboleth.metadata.MockItem;
 import net.shibboleth.metadata.SimpleItemCollectionFactory;
+import net.shibboleth.shared.collection.CollectionSupport;
 import net.shibboleth.shared.component.ComponentInitializationException;
 
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
 /** Unit test of {@link SplitMergeStage}. */
 public class SplitMergeStageTest {
 
@@ -43,10 +43,12 @@ public class SplitMergeStageTest {
         Assert.assertEquals(stage.getCollectionFactory(), factory);
     }
 
+    @SuppressWarnings("removal")
     @Test public void testExecutorService() {
         SplitMergeStage<Object> stage = new SplitMergeStage<>();
 
         ExecutorService executor = Executors.newSingleThreadExecutor();
+        assert executor != null;
         stage.setExecutorService(executor);
         Assert.assertEquals(stage.getExecutorService(), executor);
     }
@@ -55,6 +57,7 @@ public class SplitMergeStageTest {
         SplitMergeStage<Object> stage = new SplitMergeStage<>();
 
         ExecutorService executor = Executors.newSingleThreadExecutor();
+        assert executor != null;
         stage.setExecutor(executor);
         Assert.assertEquals(stage.getExecutor(), executor);
     }
@@ -96,7 +99,7 @@ public class SplitMergeStageTest {
         stage.setSelectionStrategy(x -> true);
         stage.initialize();
         Assert.assertNotNull(stage.getCollectionFactory());
-        Assert.assertNotNull(stage.getExecutorService());
+        Assert.assertNotNull(stage.getExecutor());
 
         stage = new SplitMergeStage<>();
         stage.setId("test");
@@ -125,12 +128,12 @@ public class SplitMergeStageTest {
         SimplePipeline<String> selectedPipeline = new SimplePipeline<>();
         selectedPipeline.setId("selectedPipeline");
         CountingStage<String> selectedCount = new CountingStage<>();
-        selectedPipeline.setStages(Collections.<Stage<String>>singletonList(selectedCount));
+        selectedPipeline.setStages(CollectionSupport.listOf(selectedCount));
 
         SimplePipeline<String> nonselectedPipeline = new SimplePipeline<>();
         nonselectedPipeline.setId("nonselectedPipeline");
         CountingStage<String> nonselectedCount = new CountingStage<>();
-        nonselectedPipeline.setStages(Collections.<Stage<String>>singletonList(nonselectedCount));
+        nonselectedPipeline.setStages(CollectionSupport.listOf(nonselectedCount));
 
         MockItem item1 = new MockItem("one");
         MockItem item2 = new MockItem("two");
@@ -169,12 +172,12 @@ public class SplitMergeStageTest {
         final SimplePipeline<String> selectedPipeline = new SimplePipeline<>();
         selectedPipeline.setId("selectedPipeline");
         final TerminatingStage<String> selectedTerm = new TerminatingStage<>();
-        selectedPipeline.setStages(Collections.<Stage<String>>singletonList(selectedTerm));
+        selectedPipeline.setStages(CollectionSupport.listOf(selectedTerm));
 
         SimplePipeline<String> nonselectedPipeline = new SimplePipeline<>();
         nonselectedPipeline.setId("nonselectedPipeline");
         CountingStage<String> nonselectedCount = new CountingStage<>();
-        nonselectedPipeline.setStages(Collections.<Stage<String>>singletonList(nonselectedCount));
+        nonselectedPipeline.setStages(CollectionSupport.listOf(nonselectedCount));
 
         MockItem item1 = new MockItem("one");
         MockItem item2 = new MockItem("two");
@@ -208,12 +211,12 @@ public class SplitMergeStageTest {
         final SimplePipeline<String> selectedPipeline = new SimplePipeline<>();
         selectedPipeline.setId("selectedPipeline");
         CountingStage<String> selectedCount = new CountingStage<>();
-        selectedPipeline.setStages(Collections.<Stage<String>>singletonList(selectedCount));
+        selectedPipeline.setStages(CollectionSupport.listOf(selectedCount));
 
         SimplePipeline<String> nonselectedPipeline = new SimplePipeline<>();
         nonselectedPipeline.setId("nonselectedPipeline");
         final TerminatingStage<String> selectedTerm = new TerminatingStage<>();
-        nonselectedPipeline.setStages(Collections.<Stage<String>>singletonList(selectedTerm));
+        nonselectedPipeline.setStages(CollectionSupport.listOf(selectedTerm));
 
         MockItem item1 = new MockItem("one");
         MockItem item2 = new MockItem("two");
diff --git a/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/StaticItemSourceStageTest.java b/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/StaticItemSourceStageTest.java
index b9a1a8e..207325c 100644
--- a/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/StaticItemSourceStageTest.java
+++ b/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/StaticItemSourceStageTest.java
@@ -2,13 +2,13 @@
 package net.shibboleth.metadata.pipeline;
 
 import java.util.ArrayList;
-import java.util.List;
 
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
 import net.shibboleth.metadata.Item;
 import net.shibboleth.metadata.MockItem;
+import net.shibboleth.shared.collection.CollectionSupport;
 
 public class StaticItemSourceStageTest {
     
@@ -16,7 +16,7 @@ public class StaticItemSourceStageTest {
     public void testExecute() throws Exception {
         final var stage = new StaticItemSourceStage<String>();
         stage.setId("test");
-        stage.setSourceItems(List.of(new MockItem("one"), new MockItem("two")));
+        stage.setSourceItems(CollectionSupport.listOf(new MockItem("one"), new MockItem("two")));
         stage.initialize();
         final var items = new ArrayList<Item<String>>();
         stage.execute(items);
diff --git a/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/StatusMetadataLoggingStageTest.java b/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/StatusMetadataLoggingStageTest.java
index 4664aed..874be9a 100644
--- a/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/StatusMetadataLoggingStageTest.java
+++ b/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/StatusMetadataLoggingStageTest.java
@@ -2,7 +2,8 @@
 package net.shibboleth.metadata.pipeline;
 
 import java.util.List;
-import java.util.Set;
+
+import javax.annotation.Nonnull;
 
 import org.slf4j.LoggerFactory;
 import org.testng.Assert;
@@ -19,6 +20,7 @@ import net.shibboleth.metadata.Item;
 import net.shibboleth.metadata.ItemIdentificationStrategy;
 import net.shibboleth.metadata.MockItem;
 import net.shibboleth.metadata.WarningStatus;
+import net.shibboleth.shared.collection.CollectionSupport;
 
 
 public class StatusMetadataLoggingStageTest {
@@ -48,14 +50,14 @@ public class StatusMetadataLoggingStageTest {
     private static class StringSelfIdentificationStrategy implements ItemIdentificationStrategy<String> {
 
         @Override
-        public String getItemIdentifier(Item<String> item) {
+        public @Nonnull String getItemIdentifier(@Nonnull Item<String> item) {
             return item.unwrap();
         }
         
     }
 
-    private List<Item<String>> getItems() {
-        final List<Item<String>> items = List.of(new MockItem("item1"),
+    private @Nonnull List<Item<String>> getItems() {
+        final @Nonnull List<Item<String>> items = CollectionSupport.listOf(new MockItem("item1"),
                 new MockItem("item2"), new MockItem("item3"));
         items.get(0).getItemMetadata().put(new ErrorStatus("comp1", "err1"));
         items.get(0).getItemMetadata().put(new ErrorStatus("comp1", "err2"));
@@ -71,7 +73,7 @@ public class StatusMetadataLoggingStageTest {
         final var stage = new StatusMetadataLoggingStage<String>();
         stage.setId("test");
         stage.setIdentificationStrategy(new StringSelfIdentificationStrategy());
-        stage.setSelectionRequirements(Set.of(ErrorStatus.class, InfoStatus.class, WarningStatus.class));
+        stage.setSelectionRequirements(CollectionSupport.setOf(ErrorStatus.class, InfoStatus.class, WarningStatus.class));
         stage.initialize();
         
         stage.execute(items);
@@ -88,7 +90,7 @@ public class StatusMetadataLoggingStageTest {
         final var stage = new StatusMetadataLoggingStage<String>();
         stage.setId("test");
         stage.setIdentificationStrategy(new StringSelfIdentificationStrategy());
-        stage.setSelectionRequirements(Set.of(ErrorStatus.class));
+        stage.setSelectionRequirements(CollectionSupport.setOf(ErrorStatus.class));
         stage.initialize();
         
         stage.execute(items);
diff --git a/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/TerminatingStage.java b/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/TerminatingStage.java
index 05bc560..2264766 100644
--- a/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/TerminatingStage.java
+++ b/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/TerminatingStage.java
@@ -19,6 +19,8 @@ package net.shibboleth.metadata.pipeline;
 
 import java.util.List;
 
+import javax.annotation.Nonnull;
+
 import net.shibboleth.metadata.Item;
 
 /**
@@ -34,7 +36,7 @@ class TerminatingStage<T> extends AbstractStage<T> {
     }
 
     @Override
-    protected void doExecute(List<Item<T>> items) throws StageProcessingException {
+    protected void doExecute(@Nonnull List<Item<T>> items) throws StageProcessingException {
         throw new TerminationException("from TerminatingStage");
     }
 }
diff --git a/mda-framework/src/test/java/net/shibboleth/metadata/validate/x509/BaseX509ValidatorTest.java b/mda-framework/src/test/java/net/shibboleth/metadata/validate/x509/BaseX509ValidatorTest.java
index b7c0aa0..5041fc3 100644
--- a/mda-framework/src/test/java/net/shibboleth/metadata/validate/x509/BaseX509ValidatorTest.java
+++ b/mda-framework/src/test/java/net/shibboleth/metadata/validate/x509/BaseX509ValidatorTest.java
@@ -22,6 +22,8 @@ import java.security.cert.CertificateFactory;
 import java.security.cert.X509Certificate;
 import java.util.Collection;
 
+import javax.annotation.Nonnull;
+
 import org.springframework.core.io.Resource;
 import org.testng.Assert;
 
@@ -34,17 +36,20 @@ import net.shibboleth.metadata.validate.Validator;
 
 public abstract class BaseX509ValidatorTest extends BaseTest {
     
-    private CertificateFactory factory;
+    private @Nonnull CertificateFactory factory;
 
-    public BaseX509ValidatorTest(final Class<?> clazz) throws Exception {
+    public BaseX509ValidatorTest(final @Nonnull Class<?> clazz) throws Exception {
         super(clazz);
-        factory = CertificateFactory.getInstance("X.509");
+        var fac = CertificateFactory.getInstance("X.509");
+        assert fac != null;
+        factory = fac;
     }
 
-    protected X509Certificate getCertificate(final String id) throws Exception {
+    protected @Nonnull X509Certificate getCertificate(final String id) throws Exception {
         final Resource certResource = getClasspathResource(id);
         final X509Certificate cert =
                 (X509Certificate) factory.generateCertificate(certResource.getInputStream());
+        assert cert != null;
         return cert;
     }
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list