[java-shib-shared] branch main updated: Null handling: introduce null-safe version if Arrays.toList()

Rod Widdowson rdw at steadingsoftware.com
Wed Mar 8 15:03:32 UTC 2023


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

rdw 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=0eca34c2d776d7fad23577461617a1c73b29c227

The following commit(s) were added to refs/heads/main by this push:
     new 0eca34c2 Null handling: introduce null-safe version if Arrays.toList()
0eca34c2 is described below

commit 0eca34c2d776d7fad23577461617a1c73b29c227
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Wed Mar 8 14:53:05 2023 +0000

    Null handling: introduce null-safe version if Arrays.toList()
    
    Also do some drive by clean up.
---
 .../httpclient/ContextHandlingHttpClientTest.java  | 197 ++++++++++++++++-----
 .../shared/collection/CollectionSupport.java       |  14 +-
 .../collection/ClassToInstanceMultiMapTest.java    |   9 +
 .../LockableClassToInstanceMultiMapTest.java       |   9 +
 4 files changed, 181 insertions(+), 48 deletions(-)

diff --git a/shib-networking/src/test/java/net/shibboleth/shared/httpclient/ContextHandlingHttpClientTest.java b/shib-networking/src/test/java/net/shibboleth/shared/httpclient/ContextHandlingHttpClientTest.java
index 71cbef3e..3bc7ccf5 100644
--- a/shib-networking/src/test/java/net/shibboleth/shared/httpclient/ContextHandlingHttpClientTest.java
+++ b/shib-networking/src/test/java/net/shibboleth/shared/httpclient/ContextHandlingHttpClientTest.java
@@ -41,6 +41,8 @@ import org.testng.annotations.BeforeClass;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import net.shibboleth.shared.collection.CollectionSupport;
+
 @SuppressWarnings("javadoc")
 public class ContextHandlingHttpClientTest {
     
@@ -81,6 +83,7 @@ public class ContextHandlingHttpClientTest {
     public void testNoHandlers() throws IOException {
         client = new ContextHandlingHttpClient(new MockHttpClient());
         context = HttpClientContext.create();
+        assert context!=null;
         
         //Non-context execute methods
         Assert.assertSame(client.execute(request), STATIC_RESPONSE_HTTP);
@@ -97,7 +100,7 @@ public class ContextHandlingHttpClientTest {
     
     @Test
     public void testStaticOnly() throws IOException {
-        client = new ContextHandlingHttpClient(new MockHttpClient(), List.of(staticOne, staticTwo, staticThree));
+        client = new ContextHandlingHttpClient(new MockHttpClient(), CollectionSupport.listOf(staticOne, staticTwo, staticThree));
         
         List<String> control = List.of(
                 "before-static-1",
@@ -109,14 +112,17 @@ public class ContextHandlingHttpClientTest {
                 );
         
         context = HttpClientContext.create();
+        assert context!=null;
         Assert.assertSame(client.execute(request, context), STATIC_RESPONSE_HTTP);
         Assert.assertEquals(context.getAttribute(TestContextHandler.TEST_KEY), control);
         
         context = HttpClientContext.create();
+        assert context!=null;
         Assert.assertSame(client.execute(request, context, responseHandler), STATIC_RESPONSE_HANDLER);
         Assert.assertEquals(context.getAttribute(TestContextHandler.TEST_KEY), control);
         
         context = HttpClientContext.create();
+        assert context!=null;
         Assert.assertSame(client.execute(target, request, context), STATIC_RESPONSE_HTTP);
         Assert.assertEquals(context.getAttribute(TestContextHandler.TEST_KEY), control);
         
@@ -141,21 +147,25 @@ public class ContextHandlingHttpClientTest {
         List<HttpClientContextHandler> handlers = List.of(dynamicOne, dynamicTwo, dynamicThree);
         
         context = HttpClientContext.create();
+        assert context!=null;
         HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
         Assert.assertSame(client.execute(request, context), STATIC_RESPONSE_HTTP);
         Assert.assertEquals(context.getAttribute(TestContextHandler.TEST_KEY), control);
         
         context = HttpClientContext.create();
+        assert context!=null;
         HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
         Assert.assertSame(client.execute(request, context, responseHandler), STATIC_RESPONSE_HANDLER);
         Assert.assertEquals(context.getAttribute(TestContextHandler.TEST_KEY), control);
         
         context = HttpClientContext.create();
+        assert context!=null;
         HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
         Assert.assertSame(client.execute(target, request, context), STATIC_RESPONSE_HTTP);
         Assert.assertEquals(context.getAttribute(TestContextHandler.TEST_KEY), control);
         
         context = HttpClientContext.create();
+        assert context!=null;
         HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
         Assert.assertSame(client.execute(target, request, context, responseHandler), STATIC_RESPONSE_HANDLER);
         Assert.assertEquals(context.getAttribute(TestContextHandler.TEST_KEY), control);
@@ -163,7 +173,7 @@ public class ContextHandlingHttpClientTest {
     
     @Test
     public void testStaticAndDynamic() throws IOException {
-        client = new ContextHandlingHttpClient(new MockHttpClient(), List.of(staticOne, staticTwo, staticThree));
+        client = new ContextHandlingHttpClient(new MockHttpClient(), CollectionSupport.listOf(staticOne, staticTwo, staticThree));
         
         List<String> control = List.of(
                 "before-static-1",
@@ -183,21 +193,25 @@ public class ContextHandlingHttpClientTest {
         List<HttpClientContextHandler> handlers = List.of(dynamicOne, dynamicTwo, dynamicThree);
         
         context = HttpClientContext.create();
+        assert context!=null;
         HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
         Assert.assertSame(client.execute(request, context), STATIC_RESPONSE_HTTP);
         Assert.assertEquals(context.getAttribute(TestContextHandler.TEST_KEY), control);
         
         context = HttpClientContext.create();
+        assert context!=null;
         HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
         Assert.assertSame(client.execute(request, context, responseHandler), STATIC_RESPONSE_HANDLER);
         Assert.assertEquals(context.getAttribute(TestContextHandler.TEST_KEY), control);
         
         context = HttpClientContext.create();
+        assert context!=null;
         HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
         Assert.assertSame(client.execute(target, request, context), STATIC_RESPONSE_HTTP);
         Assert.assertEquals(context.getAttribute(TestContextHandler.TEST_KEY), control);
         
         context = HttpClientContext.create();
+        assert context!=null;
         HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
         Assert.assertSame(client.execute(target, request, context, responseHandler), STATIC_RESPONSE_HANDLER);
         Assert.assertEquals(context.getAttribute(TestContextHandler.TEST_KEY), control);
@@ -206,7 +220,7 @@ public class ContextHandlingHttpClientTest {
     @Test
     public void testWrappedClientThrowsIOException() throws IOException {
         IOException error = new IOException();
-        client = new ContextHandlingHttpClient(new MockHttpClient(error), List.of(staticOne, staticTwo, staticThree));
+        client = new ContextHandlingHttpClient(new MockHttpClient(error), CollectionSupport.listOf(staticOne, staticTwo, staticThree));
         
         List<String> control = List.of(
                 "before-static-1",
@@ -227,6 +241,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -237,6 +252,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -247,6 +263,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -257,6 +274,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -269,7 +287,7 @@ public class ContextHandlingHttpClientTest {
     @Test
     public void testWrappedClientThrowsRuntimeException() throws IOException {
         RuntimeException error = new RuntimeException();
-        client = new ContextHandlingHttpClient(new MockHttpClient(error), List.of(staticOne, staticTwo, staticThree));
+        client = new ContextHandlingHttpClient(new MockHttpClient(error), CollectionSupport.listOf(staticOne, staticTwo, staticThree));
         
         List<String> control = List.of(
                 "before-static-1",
@@ -290,6 +308,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -300,6 +319,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -310,6 +330,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -320,6 +341,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -332,7 +354,7 @@ public class ContextHandlingHttpClientTest {
     @Test
     public void testWrappedClientThrowsError() throws IOException {
         Error error = new Error();
-        client = new ContextHandlingHttpClient(new MockHttpClient(error), List.of(staticOne, staticTwo, staticThree));
+        client = new ContextHandlingHttpClient(new MockHttpClient(error), CollectionSupport.listOf(staticOne, staticTwo, staticThree));
         
         List<String> control = List.of(
                 "before-static-1",
@@ -349,10 +371,11 @@ public class ContextHandlingHttpClientTest {
                 "after-static-1"
                 );
         
-        List<HttpClientContextHandler> handlers = List.of(dynamicOne, dynamicTwo, dynamicThree);
+        List<HttpClientContextHandler> handlers = CollectionSupport.listOf(dynamicOne, dynamicTwo, dynamicThree);
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -363,6 +386,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -373,6 +397,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -383,6 +408,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -396,7 +422,7 @@ public class ContextHandlingHttpClientTest {
     public void testSingleStaticHandlerInvokeBeforeThrowsIOException() throws IOException {
         IOException error = new IOException();
         client = new ContextHandlingHttpClient(new MockHttpClient(), 
-                List.of(staticOne, new TestContextHandler("static-2", error, null), staticThree));
+                CollectionSupport.listOf(staticOne, new TestContextHandler("static-2", error, null), staticThree));
         
         List<String> control = List.of(
                 "before-static-1",
@@ -417,6 +443,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -427,6 +454,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -437,6 +465,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -447,6 +476,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -460,7 +490,7 @@ public class ContextHandlingHttpClientTest {
     public void testSingleStaticHandlerInvokeAfterThrowsIOException() throws IOException {
         IOException error = new IOException();
         client = new ContextHandlingHttpClient(new MockHttpClient(), 
-                List.of(staticOne, new TestContextHandler("static-2", null, error), staticThree));
+                CollectionSupport.listOf(staticOne, new TestContextHandler("static-2", null, error), staticThree));
         
         List<String> control = List.of(
                 "before-static-1",
@@ -481,6 +511,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -491,6 +522,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -501,6 +533,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -511,6 +544,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -524,7 +558,7 @@ public class ContextHandlingHttpClientTest {
     public void testSingleStaticHandlerInvokeBeforeThrowsRuntimeException() throws IOException {
         RuntimeException error = new RuntimeException();
         client = new ContextHandlingHttpClient(new MockHttpClient(), 
-                List.of(staticOne, new TestContextHandler("static-2", error, null), staticThree));
+                CollectionSupport.listOf(staticOne, new TestContextHandler("static-2", error, null), staticThree));
         
         List<String> control = List.of(
                 "before-static-1",
@@ -545,6 +579,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -555,6 +590,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -565,6 +601,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -575,6 +612,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -588,7 +626,7 @@ public class ContextHandlingHttpClientTest {
     public void testSingleStaticHandlerInvokeAfterThrowsRuntimeException() throws IOException {
         RuntimeException error = new RuntimeException();
         client = new ContextHandlingHttpClient(new MockHttpClient(), 
-                List.of(staticOne, new TestContextHandler("static-2", null, error), staticThree));
+                CollectionSupport.listOf(staticOne, new TestContextHandler("static-2", null, error), staticThree));
         
         List<String> control = List.of(
                 "before-static-1",
@@ -609,6 +647,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -619,6 +658,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -629,6 +669,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -639,6 +680,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -653,7 +695,7 @@ public class ContextHandlingHttpClientTest {
         IOException error1 = new IOException();
         IOException error3 = new IOException();
         client = new ContextHandlingHttpClient(new MockHttpClient(), 
-                List.of( new TestContextHandler("static-1", error1, null), staticTwo, new TestContextHandler("static-3", error3, null)));
+                CollectionSupport.listOf( new TestContextHandler("static-1", error1, null), staticTwo, new TestContextHandler("static-3", error3, null)));
         
         List<String> control = List.of(
                 "before-static-1",
@@ -674,6 +716,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -687,6 +730,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -700,6 +744,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -713,6 +758,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -730,7 +776,7 @@ public class ContextHandlingHttpClientTest {
         RuntimeException error1 = new RuntimeException();
         RuntimeException error3 = new RuntimeException();
         client = new ContextHandlingHttpClient(new MockHttpClient(), 
-                List.of( new TestContextHandler("static-1", error1, null), staticTwo, new TestContextHandler("static-3", error3, null)));
+                 CollectionSupport.listOf( new TestContextHandler("static-1", error1, null), staticTwo, new TestContextHandler("static-3", error3, null)));
         
         List<String> control = List.of(
                 "before-static-1",
@@ -751,6 +797,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -764,6 +811,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -777,6 +825,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -790,6 +839,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -808,7 +858,7 @@ public class ContextHandlingHttpClientTest {
         IOException error1 = new IOException();
         IOException error3 = new IOException();
         client = new ContextHandlingHttpClient(new MockHttpClient(), 
-                List.of( new TestContextHandler("static-1", null, error1), staticTwo, new TestContextHandler("static-3", null, error3)));
+                CollectionSupport.listOf( new TestContextHandler("static-1", null, error1), staticTwo, new TestContextHandler("static-3", null, error3)));
         
         List<String> control = List.of(
                 "before-static-1",
@@ -829,6 +879,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -842,6 +893,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -855,6 +907,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -868,6 +921,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -885,7 +939,7 @@ public class ContextHandlingHttpClientTest {
         RuntimeException error1 = new RuntimeException();
         RuntimeException error3 = new RuntimeException();
         client = new ContextHandlingHttpClient(new MockHttpClient(), 
-                List.of( new TestContextHandler("static-1", null, error1), staticTwo, new TestContextHandler("static-3", null, error3)));
+                CollectionSupport.listOf( new TestContextHandler("static-1", null, error1), staticTwo, new TestContextHandler("static-3", null, error3)));
         
         List<String> control = List.of(
                 "before-static-1",
@@ -906,6 +960,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -919,6 +974,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -932,6 +988,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -945,6 +1002,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -962,9 +1020,9 @@ public class ContextHandlingHttpClientTest {
     public void testSingleDynamicHandlerInvokeBeforeThrowsIOException() throws IOException {
         IOException error = new IOException();
         client = new ContextHandlingHttpClient(new MockHttpClient(), 
-                List.of(staticOne, staticTwo, staticThree));
+                CollectionSupport.listOf(staticOne, staticTwo, staticThree));
         
-        List<String> control = List.of(
+        @Nonnull List<String> control = CollectionSupport.listOf(
                 "before-static-1",
                 "before-static-2",
                 "before-static-3",
@@ -983,6 +1041,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -993,6 +1052,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -1003,6 +1063,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -1013,6 +1074,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -1026,9 +1088,9 @@ public class ContextHandlingHttpClientTest {
     public void testSingleDynamicHandlerInvokeAfterThrowsIOException() throws IOException {
         IOException error = new IOException();
         client = new ContextHandlingHttpClient(new MockHttpClient(), 
-                List.of(staticOne, staticTwo, staticThree));
+                CollectionSupport.listOf(staticOne, staticTwo, staticThree));
         
-        List<String> control = List.of(
+        List<String> control = CollectionSupport.listOf(
                 "before-static-1",
                 "before-static-2",
                 "before-static-3",
@@ -1047,6 +1109,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -1057,6 +1120,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -1067,6 +1131,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -1077,6 +1142,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -1091,9 +1157,9 @@ public class ContextHandlingHttpClientTest {
     public void testSingleDynamicHandlerInvokeBeforeThrowsRuntimeException() throws IOException {
         RuntimeException error = new RuntimeException();
         client = new ContextHandlingHttpClient(new MockHttpClient(), 
-                List.of(staticOne, staticTwo, staticThree));
+                CollectionSupport.listOf(staticOne, staticTwo, staticThree));
         
-        List<String> control = List.of(
+        List<String> control = CollectionSupport.listOf(
                 "before-static-1",
                 "before-static-2",
                 "before-static-3",
@@ -1112,6 +1178,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -1122,6 +1189,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -1132,6 +1200,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -1142,6 +1211,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -1155,9 +1225,9 @@ public class ContextHandlingHttpClientTest {
     public void testSingleDynamicHandlerInvokeAfterThrowsRuntimeException() throws IOException {
         RuntimeException error = new RuntimeException();
         client = new ContextHandlingHttpClient(new MockHttpClient(), 
-                List.of(staticOne, staticTwo, staticThree));
+                CollectionSupport.listOf(staticOne, staticTwo, staticThree));
         
-        List<String> control = List.of(
+        List<String> control = CollectionSupport.listOf(
                 "before-static-1",
                 "before-static-2",
                 "before-static-3",
@@ -1176,6 +1246,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -1186,6 +1257,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -1196,6 +1268,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -1206,6 +1279,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -1220,9 +1294,9 @@ public class ContextHandlingHttpClientTest {
     public void testMultipleDynamicHandlersInvokeBeforeThrowIOException() throws IOException {
         IOException error1 = new IOException();
         IOException error3 = new IOException();
-        client = new ContextHandlingHttpClient(new MockHttpClient(), List.of(staticOne, staticTwo, staticThree));
+        client = new ContextHandlingHttpClient(new MockHttpClient(), CollectionSupport.listOf(staticOne, staticTwo, staticThree));
         
-        List<String> control = List.of(
+        List<String> control = CollectionSupport.listOf(
                 "before-static-1",
                 "before-static-2",
                 "before-static-3",
@@ -1242,6 +1316,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -1255,6 +1330,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -1268,6 +1344,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -1281,6 +1358,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -1297,9 +1375,9 @@ public class ContextHandlingHttpClientTest {
     public void testMultipleDynamicHandlersInvokeBeforeThrowRuntimeException() throws IOException {
         RuntimeException error1 = new RuntimeException();
         RuntimeException error3 = new RuntimeException();
-        client = new ContextHandlingHttpClient(new MockHttpClient(), List.of(staticOne, staticTwo, staticThree));
+        client = new ContextHandlingHttpClient(new MockHttpClient(), CollectionSupport.listOf(staticOne, staticTwo, staticThree));
         
-        List<String> control = List.of(
+        List<String> control = CollectionSupport.listOf(
                 "before-static-1",
                 "before-static-2",
                 "before-static-3",
@@ -1319,6 +1397,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -1332,6 +1411,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -1345,6 +1425,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -1358,6 +1439,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -1374,9 +1456,9 @@ public class ContextHandlingHttpClientTest {
     public void testMultipleDynamicHandlersInvokeAfterThrowIOException() throws IOException {
         IOException error1 = new IOException();
         IOException error3 = new IOException();
-        client = new ContextHandlingHttpClient(new MockHttpClient(), List.of(staticOne, staticTwo, staticThree));
+        client = new ContextHandlingHttpClient(new MockHttpClient(), CollectionSupport.listOf(staticOne, staticTwo, staticThree));
         
-        List<String> control = List.of(
+        List<String> control = CollectionSupport.listOf(
                 "before-static-1",
                 "before-static-2",
                 "before-static-3",
@@ -1396,6 +1478,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -1409,6 +1492,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -1422,6 +1506,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -1435,6 +1520,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -1451,9 +1537,9 @@ public class ContextHandlingHttpClientTest {
     public void testMultipleDynamicHandlersInvokeAfterThrowRuntimeException() throws IOException {
         RuntimeException error1 = new RuntimeException();
         RuntimeException error3 = new RuntimeException();
-        client = new ContextHandlingHttpClient(new MockHttpClient(), List.of(staticOne, staticTwo, staticThree));
+        client = new ContextHandlingHttpClient(new MockHttpClient(), CollectionSupport.listOf(staticOne, staticTwo, staticThree));
         
-        List<String> control = List.of(
+        List<String> control = CollectionSupport.listOf(
                 "before-static-1",
                 "before-static-2",
                 "before-static-3",
@@ -1473,6 +1559,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -1486,6 +1573,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -1499,6 +1587,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -1512,6 +1601,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -1530,7 +1620,7 @@ public class ContextHandlingHttpClientTest {
         IOException staticBeforeError = null;
         IOException dynamicAfterError = null;
         
-        List<String> control = List.of(
+        List<String> control = CollectionSupport.listOf(
                 "before-static-1",
                 "before-static-2",
                 "before-static-3",
@@ -1551,11 +1641,12 @@ public class ContextHandlingHttpClientTest {
         dynamicAfterError = new IOException();
         
         client = new ContextHandlingHttpClient(new MockHttpClient(), 
-                List.of(staticOne, new TestContextHandler("static-2", staticBeforeError, null), staticThree));
-        dynamicHandlers = List.of(dynamicOne, new TestContextHandler("dynamic-2", null, dynamicAfterError), dynamicThree);
+                CollectionSupport.listOf(staticOne, new TestContextHandler("static-2", staticBeforeError, null), staticThree));
+        dynamicHandlers = CollectionSupport.listOf(dynamicOne, new TestContextHandler("dynamic-2", null, dynamicAfterError), dynamicThree);
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(dynamicHandlers);
             client.execute(request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -1570,11 +1661,12 @@ public class ContextHandlingHttpClientTest {
         dynamicAfterError = new IOException();
         
         client = new ContextHandlingHttpClient(new MockHttpClient(), 
-                List.of(staticOne, new TestContextHandler("static-2", staticBeforeError, null), staticThree));
+                CollectionSupport.listOf(staticOne, new TestContextHandler("static-2", staticBeforeError, null), staticThree));
         dynamicHandlers = List.of(dynamicOne, new TestContextHandler("dynamic-2", null, dynamicAfterError), dynamicThree);
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(dynamicHandlers);
             client.execute(request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -1589,11 +1681,12 @@ public class ContextHandlingHttpClientTest {
         dynamicAfterError = new IOException();
         
         client = new ContextHandlingHttpClient(new MockHttpClient(), 
-                List.of(staticOne, new TestContextHandler("static-2", staticBeforeError, null), staticThree));
-        dynamicHandlers = List.of(dynamicOne, new TestContextHandler("dynamic-2", null, dynamicAfterError), dynamicThree);
+                CollectionSupport.listOf(staticOne, new TestContextHandler("static-2", staticBeforeError, null), staticThree));
+        dynamicHandlers = CollectionSupport.listOf(dynamicOne, new TestContextHandler("dynamic-2", null, dynamicAfterError), dynamicThree);
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(dynamicHandlers);
             client.execute(target, request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -1608,11 +1701,12 @@ public class ContextHandlingHttpClientTest {
         dynamicAfterError = new IOException();
         
         client = new ContextHandlingHttpClient(new MockHttpClient(), 
-                List.of(staticOne, new TestContextHandler("static-2", staticBeforeError, null), staticThree));
-        dynamicHandlers = List.of(dynamicOne, new TestContextHandler("dynamic-2", null, dynamicAfterError), dynamicThree);
+                CollectionSupport.listOf(staticOne, new TestContextHandler("static-2", staticBeforeError, null), staticThree));
+        dynamicHandlers = CollectionSupport.listOf(dynamicOne, new TestContextHandler("dynamic-2", null, dynamicAfterError), dynamicThree);
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(dynamicHandlers);
             client.execute(target, request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -1629,9 +1723,9 @@ public class ContextHandlingHttpClientTest {
         RuntimeException staticBeforeError = new RuntimeException();
         RuntimeException dynamicAfterError = new RuntimeException();
         client = new ContextHandlingHttpClient(new MockHttpClient(), 
-                List.of(staticOne, new TestContextHandler("static-2", staticBeforeError, null), staticThree));
+                CollectionSupport.listOf(staticOne, new TestContextHandler("static-2", staticBeforeError, null), staticThree));
         
-        List<String> control = List.of(
+        List<String> control = CollectionSupport.listOf(
                 "before-static-1",
                 "before-static-2",
                 "before-static-3",
@@ -1650,6 +1744,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -1662,6 +1757,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -1674,6 +1770,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -1686,6 +1783,7 @@ public class ContextHandlingHttpClientTest {
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(handlers);
             client.execute(target, request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -1702,7 +1800,7 @@ public class ContextHandlingHttpClientTest {
         IOException clientError = null;
         IOException dynamicAfterError = null;
         
-        List<String> control = List.of(
+        List<String> control = CollectionSupport.listOf(
                 "before-static-1",
                 "before-static-2",
                 "before-static-3",
@@ -1723,11 +1821,12 @@ public class ContextHandlingHttpClientTest {
         dynamicAfterError = new IOException();
         
         client = new ContextHandlingHttpClient(new MockHttpClient(clientError), 
-                List.of(staticOne, staticTwo, staticThree));
+                CollectionSupport.listOf(staticOne, staticTwo, staticThree));
         dynamicHandlers = List.of(dynamicOne, new TestContextHandler("dynamic-2", null, dynamicAfterError), dynamicThree);
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(dynamicHandlers);
             client.execute(request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -1742,11 +1841,12 @@ public class ContextHandlingHttpClientTest {
         dynamicAfterError = new IOException();
         
         client = new ContextHandlingHttpClient(new MockHttpClient(clientError), 
-                List.of(staticOne, staticTwo, staticThree));
+                CollectionSupport.listOf(staticOne, staticTwo, staticThree));
         dynamicHandlers = List.of(dynamicOne, new TestContextHandler("dynamic-2", null, dynamicAfterError), dynamicThree);
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(dynamicHandlers);
             client.execute(request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -1761,11 +1861,12 @@ public class ContextHandlingHttpClientTest {
         dynamicAfterError = new IOException();
         
         client = new ContextHandlingHttpClient(new MockHttpClient(clientError), 
-                List.of(staticOne, staticTwo, staticThree));
+                CollectionSupport.listOf(staticOne, staticTwo, staticThree));
         dynamicHandlers = List.of(dynamicOne, new TestContextHandler("dynamic-2", null, dynamicAfterError), dynamicThree);
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(dynamicHandlers);
             client.execute(target, request, context);
             Assert.fail("Wrapped client should have thrown");
@@ -1780,11 +1881,12 @@ public class ContextHandlingHttpClientTest {
         dynamicAfterError = new IOException();
         
         client = new ContextHandlingHttpClient(new MockHttpClient(clientError), 
-                List.of(staticOne, staticTwo, staticThree));
+                CollectionSupport.listOf(staticOne, staticTwo, staticThree));
         dynamicHandlers = List.of(dynamicOne, new TestContextHandler("dynamic-2", null, dynamicAfterError), dynamicThree);
         
         try {
             context = HttpClientContext.create();
+            assert context!=null;
             HttpClientSupport.getDynamicContextHandlerList(context).addAll(dynamicHandlers);
             client.execute(target, request, context, responseHandler);
             Assert.fail("Wrapped client should have thrown");
@@ -1822,7 +1924,7 @@ public class ContextHandlingHttpClientTest {
         }
         
         /** {@inheritDoc} */
-        public void invokeBefore(HttpClientContext context, ClassicHttpRequest request) throws IOException {
+        public void invokeBefore(@Nonnull HttpClientContext context, @Nonnull ClassicHttpRequest request) throws IOException {
             if (name != null) {
                 addValue(context, "before-" + name);
             }
@@ -1830,7 +1932,7 @@ public class ContextHandlingHttpClientTest {
         }
 
         /** {@inheritDoc} */
-        public void invokeAfter(HttpClientContext context, ClassicHttpRequest request) throws IOException {
+        public void invokeAfter(@Nonnull HttpClientContext context, @Nonnull ClassicHttpRequest request) throws IOException {
             if (name != null) {
                 addValue(context, "after-" + name);
             }
@@ -1838,6 +1940,7 @@ public class ContextHandlingHttpClientTest {
         }
         
         private void addValue(HttpClientContext context, String value) {
+            @SuppressWarnings("unchecked")
             List<String> attrib = context.getAttribute(TEST_KEY, List.class);
             if (attrib == null) {
                 attrib = new ArrayList<>();
diff --git a/shib-support/src/main/java/net/shibboleth/shared/collection/CollectionSupport.java b/shib-support/src/main/java/net/shibboleth/shared/collection/CollectionSupport.java
index 544afe81..89b30c7e 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/collection/CollectionSupport.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/collection/CollectionSupport.java
@@ -17,6 +17,7 @@
 
 package net.shibboleth.shared.collection;
 
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
@@ -276,5 +277,16 @@ public final class CollectionSupport {
             @Nonnull final Map<? extends U, ? extends T> map) {
         return Map.copyOf(map);
     }
-    
+ 
+    /** Creates a mutable List from an array.
+     * @param <T> the class of the objects in the array
+     * @param a the array by which the list will be backed
+     * @return a list view of the specified array
+     * @throws NullPointerException if the specified array is {@code null}
+     */
+    @SafeVarargs
+    @SuppressWarnings("null")
+    @Nonnull @NonnullElements @Unmodifiable @NotLive public static <T> List<T> arrayAsList(@Nonnull T... a) {
+        return Arrays.asList(a);
+    }
 }
\ No newline at end of file
diff --git a/shib-support/src/test/java/net/shibboleth/shared/collection/ClassToInstanceMultiMapTest.java b/shib-support/src/test/java/net/shibboleth/shared/collection/ClassToInstanceMultiMapTest.java
index 775f3c31..b7b812de 100644
--- a/shib-support/src/test/java/net/shibboleth/shared/collection/ClassToInstanceMultiMapTest.java
+++ b/shib-support/src/test/java/net/shibboleth/shared/collection/ClassToInstanceMultiMapTest.java
@@ -78,12 +78,15 @@ public class ClassToInstanceMultiMapTest {
         ClassToInstanceMultiMap<Temporal> map = new ClassToInstanceMultiMap<>();
 
         ZonedDateTime now = ZonedDateTime.now();
+        assert now!=null;
         map.put(now);
 
         ZonedDateTime now100 = now.plusMinutes(100);
+        assert now100!=null;
         map.put(now100);
 
         Instant instant = Instant.now();
+        assert instant!=null;
         map.put(instant);
 
         Assert.assertEquals(map.values().size(), 3);
@@ -101,16 +104,19 @@ public class ClassToInstanceMultiMapTest {
         final ClassToInstanceMultiMap<Temporal> map3 = new ClassToInstanceMultiMap<>();
 
         final ZonedDateTime now = ZonedDateTime.now();
+        assert now!=null;
         map.put(now);
         map2.put(now);
         map3.put(now);
 
         final ZonedDateTime now100 = now.plusMinutes(100);
+        assert now100!=null;
         map.put(now100);
         map2.put(now100);
         map3.put(now100);
 
         final Instant instant = Instant.now();
+        assert instant!=null;
         map.put(instant);
         map2.put(instant);
 
@@ -313,12 +319,15 @@ public class ClassToInstanceMultiMapTest {
 
     protected void populate(ClassToInstanceMultiMap<Temporal> map) {
         ZonedDateTime now = ZonedDateTime.now();
+        assert now!=null;
         map.put(now);
 
         ZonedDateTime now100 = now.plusMinutes(100);
+        assert now100!=null;
         map.put(now100);
 
         Instant instant = Instant.now();
+        assert instant!=null;
         map.put(instant);
     }
 
diff --git a/shib-support/src/test/java/net/shibboleth/shared/collection/LockableClassToInstanceMultiMapTest.java b/shib-support/src/test/java/net/shibboleth/shared/collection/LockableClassToInstanceMultiMapTest.java
index 437805af..b3987e56 100644
--- a/shib-support/src/test/java/net/shibboleth/shared/collection/LockableClassToInstanceMultiMapTest.java
+++ b/shib-support/src/test/java/net/shibboleth/shared/collection/LockableClassToInstanceMultiMapTest.java
@@ -78,12 +78,15 @@ public class LockableClassToInstanceMultiMapTest {
         LockableClassToInstanceMultiMap<Temporal> map = new LockableClassToInstanceMultiMap<>();
 
         ZonedDateTime now = ZonedDateTime.now();
+        assert now!=null;
         map.put(now);
 
         ZonedDateTime now100 = now.plusMinutes(100);
+        assert now100!=null;
         map.put(now100);
 
         Instant instant = Instant.now();
+        assert instant!=null;
         map.put(instant);
 
         Assert.assertEquals(map.valuesWithLock().size(), 3);
@@ -101,16 +104,19 @@ public class LockableClassToInstanceMultiMapTest {
         final LockableClassToInstanceMultiMap<Temporal> map3 = new LockableClassToInstanceMultiMap<>();
 
         final ZonedDateTime now = ZonedDateTime.now();
+        assert now!=null;
         map.putWithLock(now);
         map2.putWithLock(now);
         map3.putWithLock(now);
 
         final ZonedDateTime now100 = now.plusMinutes(100);
+        assert now100!=null;
         map.putWithLock(now100);
         map2.putWithLock(now100);
         map3.putWithLock(now100);
 
         final Instant instant = Instant.now();
+        assert instant!=null;
         map.putWithLock(instant);
         map2.putWithLock(instant);
 
@@ -313,12 +319,15 @@ public class LockableClassToInstanceMultiMapTest {
 
     protected void populate(ClassToInstanceMultiMap<Temporal> map) {
         ZonedDateTime now = ZonedDateTime.now();
+        assert now!=null;
         map.put(now);
 
         ZonedDateTime now100 = now.plusMinutes(100);
+        assert now100!=null;
         map.put(now100);
 
         Instant instant = Instant.now();
+        assert instant!=null;
         map.put(instant);
     }
 

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


More information about the commits mailing list