Issue #23507 context-propagation tests enabled

- several were deleted, several remained disabled, because they are not stable;
  I added some comment to describe what is happening.
diff --git a/nucleus/core/context-propagation/pom.xml b/nucleus/core/context-propagation/pom.xml
index 009d091..858da25 100644
--- a/nucleus/core/context-propagation/pom.xml
+++ b/nucleus/core/context-propagation/pom.xml
@@ -45,6 +45,8 @@
 
     <properties>
         <findbugs.exclude>${project.basedir}/exclude.xml</findbugs.exclude>
+        <!-- jmockit is used in test and depends on it's agent -->
+        <maven.test.jvmoptions.custom>-javaagent:"${settings.localRepository}"/org/jmockit/jmockit/${jmockit.version}/jmockit-${jmockit.version}.jar</maven.test.jvmoptions.custom>
     </properties>
 
     <dependencies>
diff --git a/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/ContextViewTest.java b/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/ContextViewTest.java
index c508dd8..7ca3b0f 100644
--- a/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/ContextViewTest.java
+++ b/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/ContextViewTest.java
@@ -17,73 +17,85 @@
 
 package org.glassfish.contextpropagation;
 
+import java.util.EnumSet;
+
+import org.glassfish.contextpropagation.adaptors.BootstrapUtils;
+import org.glassfish.contextpropagation.spi.ContextMapHelper;
+import org.glassfish.contextpropagation.wireadapters.glassfish.DefaultWireAdapter;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 public class ContextViewTest {
 
 
-//  @BeforeClass
-//  public static void setUpBeforeClass() throws Exception {
-//    BootstrapUtils.bootstrap(new DefaultWireAdapter());
-//  }
-//
-//  @Before
-//  public void setUp() throws Exception {
-//  }
-//
-//  private static class MyViewBasedContext implements ViewCapable {
-//    private View view;
-//    EnumSet<PropagationMode> propModes = PropagationMode.defaultSet();
-//
-//    private MyViewBasedContext(View aView) {
-//      view = aView;
-//    }
-//
-//    public void setFoo(String foo) {
-//      view.put("foo", foo, propModes);
-//    }
-//
-//    public String getFoo() {
-//      return view.get("foo");
-//    };
-//
-//    public void setLongValue(long value) {
-//      view.put("long value", value, propModes);
-//    }
-//
-//    public long getLongValue() {
-//      return (Long) view.get("long value");
-//    }
-//
-//  }
-//
-//  @Test
-//  public void testContextViewExample() throws InsufficientCredentialException {
-//    ContextViewFactory factory = new ContextViewFactory() {
-//
-//      @Override
-//      public ViewCapable createInstance(final View view) {
-//        return new MyViewBasedContext(view) ;
-//      }
-//
-//      @Override
-//      public EnumSet<PropagationMode> getPropagationModes() {
-//        return PropagationMode.defaultSet();
-//      }
-//    };
-//
-//    // Define prefix and register factory -- done only once during server startup phase
-//    String prefix = "my.prefix";
-//    ContextMapHelper.registerContextFactoryForPrefixNamed(prefix, factory);
-//
-//    // Get a ContextMap
-//    ContextMap wcMap = ContextMapHelper.getScopeAwareContextMap();
-//
-//    // Since this is a new ContextMap, get will create the vbContext with the registered factory
-//    MyViewBasedContext mvbContext = wcMap.createViewCapable(prefix);
-//    mvbContext.setFoo("foo value");
-//    assertEquals("foo value", mvbContext.getFoo());
-//    mvbContext.setLongValue(1);
-//    assertEquals(1L, mvbContext.getLongValue());
-//  }
+    @BeforeAll
+    public static void setUpBeforeClass() throws Exception {
+        BootstrapUtils.bootstrap(new DefaultWireAdapter());
+    }
+
+
+    private static class MyViewBasedContext implements ViewCapable {
+
+        private final View view;
+        EnumSet<PropagationMode> propModes = PropagationMode.defaultSet();
+
+        private MyViewBasedContext(View aView) {
+            view = aView;
+        }
+
+
+        public void setFoo(String foo) {
+            view.put("foo", foo, propModes);
+        }
+
+
+        public String getFoo() {
+            return view.get("foo");
+        }
+
+
+        public void setLongValue(long value) {
+            view.put("long value", value, propModes);
+        }
+
+
+        public long getLongValue() {
+            return (Long) view.get("long value");
+        }
+
+    }
+
+    @Test
+    public void testContextViewExample() throws InsufficientCredentialException {
+        ContextViewFactory factory = new ContextViewFactory() {
+
+            @Override
+            public ViewCapable createInstance(final View view) {
+                return new MyViewBasedContext(view);
+            }
+
+
+            @Override
+            public EnumSet<PropagationMode> getPropagationModes() {
+                return PropagationMode.defaultSet();
+            }
+        };
+
+        // Define prefix and register factory -- done only once during server startup phase
+        String prefix = "my.prefix";
+        ContextMapHelper.registerContextFactoryForPrefixNamed(prefix, factory);
+
+        // Get a ContextMap
+        ContextMap wcMap = ContextMapHelper.getScopeAwareContextMap();
+
+        // Since this is a new ContextMap, get will create the vbContext with the registered factory
+        MyViewBasedContext mvbContext = wcMap.createViewCapable(prefix);
+        mvbContext.setFoo("foo value");
+        assertEquals("foo value", mvbContext.getFoo());
+        mvbContext.setLongValue(1);
+        assertEquals(1L, mvbContext.getLongValue());
+    }
 
 }
diff --git a/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/LocationTest.java b/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/LocationTest.java
index 377c783..23468b8 100644
--- a/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/LocationTest.java
+++ b/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/LocationTest.java
@@ -17,67 +17,94 @@
 
 package org.glassfish.contextpropagation;
 
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+
+import org.glassfish.contextpropagation.adaptors.BootstrapUtils;
+import org.glassfish.contextpropagation.adaptors.MockLoggerAdapter;
+import org.glassfish.contextpropagation.adaptors.TestableThread;
+import org.glassfish.contextpropagation.internal.ViewImpl;
+import org.glassfish.contextpropagation.spi.ContextMapHelper;
+import org.glassfish.contextpropagation.wireadapters.glassfish.DefaultWireAdapter;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+
+import static org.glassfish.contextpropagation.adaptors.BootstrapUtils.getField;
+import static org.glassfish.contextpropagation.adaptors.BootstrapUtils.setField;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
 public class LocationTest {
 
-//  @BeforeClass
-//  public static void setupClass() {
-//    BootstrapUtils.bootstrap(new DefaultWireAdapter());
-//  }
-//
-//  @Test
-//  public void testGetOrigin() {
-//    Location location = new Location(new ViewImpl("prefix") {});
-//    assertEquals("guid", location.getOrigin());
-//    Deencapsulation.setField(location, "origin", "non-null origin");
-//    assertEquals("non-null origin", location.getOrigin());
-//  }
-//
-//  @Test
-//  public void testGetLocationId() {
-//    Location location = new Location(new ViewImpl("prefix") {});
-//    assertEquals("[0]", location.getLocationId());
-//  }
-//
-//  @Test
-//  public void testContextToPropagateAndContextAdded() {
-//    Location location = new Location(new ViewImpl("prefix") {});
-//    Location locationToPropagate = (Location) location.contextToPropagate();
-//    assertEquals(location, locationToPropagate);
-//    Location propagatedLocation = new Location(new ViewImpl("prefix") {});
-//    View view = Deencapsulation.getField(location, "view");
-//    Deencapsulation.setField(propagatedLocation, "view", view);
-//    propagatedLocation.contextAdded();
-//    assertEquals("[0, 1]", propagatedLocation.getLocationId());
-//  }
-//
-//  @Test
-//  public void testMultiplePropagations() throws Exception {
-//    ContextMap wcMap = ContextMapHelper.getScopeAwareContextMap();
-//    Location location = wcMap.getLocation();
-//    assertEquals("guid", location.getOrigin());
-//    assertEquals("[0]", location.getLocationId());
-//    // TODO NOW make sure the location is created if this is the origin of the request.
-//    for (int i = 1; i <= 3; i++) {
-//      mimicPropagation("[0, " + i + "]");
-//    }
-//  }
-//
-//  private static void mimicPropagation(final String expectedLocationId)
-//      throws Exception {
-//    ByteArrayOutputStream bos = new ByteArrayOutputStream();
-//    ContextMapHelper.getScopeAwarePropagator().sendRequest(bos, PropagationMode.SOAP);
-//
-//    final ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
-//    new TestableThread() {
-//      @Override
-//      protected void runTest() throws Exception {
-//        ContextMapHelper.getScopeAwarePropagator().receiveRequest(bis);
-//
-//        ContextMap wcMap = ContextMapHelper.getScopeAwareContextMap();
-//        Location location = wcMap.getLocation();
-//        MockLoggerAdapter.debug(location.getLocationId());
-//        assertEquals(expectedLocationId, location.getLocationId());
-//      }
-//    }.startJoinAndCheckForFailures();
-//  }
+    @BeforeAll
+    public static void setupClass() {
+        BootstrapUtils.bootstrap(new DefaultWireAdapter());
+    }
+
+
+    @Test
+    public void testGetOrigin() {
+        Location location = new Location(new ViewImpl("prefix") {
+        });
+        assertEquals("guid", location.getOrigin());
+        setField(location, "origin", "non-null origin");
+        assertEquals("non-null origin", location.getOrigin());
+    }
+
+
+    @Test
+    public void testGetLocationId() {
+        Location location = new Location(new ViewImpl("prefix") {
+        });
+        assertEquals("[0]", location.getLocationId());
+    }
+
+
+    @Test
+    public void testContextToPropagateAndContextAdded() {
+        Location location = new Location(new ViewImpl("prefix") {
+        });
+        Location locationToPropagate = (Location) location.contextToPropagate();
+        assertEquals(location, locationToPropagate);
+        Location propagatedLocation = new Location(new ViewImpl("prefix") {
+        });
+        View view = getField(location, "view");
+        setField(propagatedLocation, "view", view);
+        propagatedLocation.contextAdded();
+        assertEquals("[0, 1]", propagatedLocation.getLocationId());
+    }
+
+
+    @Test
+    @Disabled("Causes ConcurrentModificationException in SimpleMap.findNext (access to iterator)")
+    public void testMultiplePropagations() throws Exception {
+        ContextMap wcMap = ContextMapHelper.getScopeAwareContextMap();
+        Location location = wcMap.getLocation();
+        assertEquals("guid", location.getOrigin());
+        assertEquals("[0]", location.getLocationId());
+        // TODO NOW make sure the location is created if this is the origin of the request.
+        for (int i = 1; i <= 3; i++) {
+            mimicPropagation("[0, " + i + "]");
+        }
+    }
+
+
+    private static void mimicPropagation(final String expectedLocationId) throws Exception {
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        ContextMapHelper.getScopeAwarePropagator().sendRequest(bos, PropagationMode.SOAP);
+
+        final ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
+        new TestableThread() {
+
+            @Override
+            protected void runTest() throws Exception {
+                ContextMapHelper.getScopeAwarePropagator().receiveRequest(bis);
+
+                ContextMap wcMap = ContextMapHelper.getScopeAwareContextMap();
+                Location location = wcMap.getLocation();
+                MockLoggerAdapter.debug(location.getLocationId());
+                assertEquals(expectedLocationId, location.getLocationId());
+            }
+        }.startJoinAndCheckForFailures();
+    }
 }
diff --git a/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/adaptors/BootstrapUtils.java b/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/adaptors/BootstrapUtils.java
index 9eff64a..954a6d2 100644
--- a/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/adaptors/BootstrapUtils.java
+++ b/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/adaptors/BootstrapUtils.java
@@ -17,6 +17,7 @@
 
 package org.glassfish.contextpropagation.adaptors;
 
+import java.lang.reflect.Field;
 import java.util.Arrays;
 import java.util.EnumSet;
 import java.util.HashSet;
@@ -27,10 +28,15 @@
 import org.glassfish.contextpropagation.PropagationMode;
 import org.glassfish.contextpropagation.View;
 import org.glassfish.contextpropagation.ViewCapable;
+import org.glassfish.contextpropagation.bootstrap.ContextBootstrap;
 import org.glassfish.contextpropagation.internal.Utils.ContextMapAdditionalAccessors;
 import org.glassfish.contextpropagation.spi.ContextMapHelper;
+import org.glassfish.contextpropagation.wireadapters.WireAdapter;
+
+import mockit.internal.reflection.FieldReflection;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
 
 public class BootstrapUtils {
 
@@ -84,26 +90,70 @@
         wcMap.get("ascii");
     }
 
-//  public static void bootstrap(WireAdapter wireAdapter) {
-//    reset();
-//    /*ThreadLocalAccessor tla = Deencapsulation.getField(ContextBootstrap.class, "threadLocalAccessor");
-//    tla.set(null);*/
-//    ContextBootstrap.configure(new MockLoggerAdapter(),
-//        wireAdapter, new MockThreadLocalAccessor(),
-//        new MockContextAccessController(), "guid");
-//  }
 
-//  public static void reset() {
-//    Deencapsulation.setField(ContextBootstrap.class, "isConfigured", false);
-//    try {
-//      ContextMapHelper.getScopeAwareContextMap().get("true");
-//      fail("Should get IllegalStateException");
-//    } catch (InsufficientCredentialException e) {
-//      fail(e.toString());
-//    } catch (IllegalStateException ignoreThisIsExpected) {}
-//  }
+    public static void bootstrap(WireAdapter wireAdapter) {
+        reset();
+        /*
+         * ThreadLocalAccessor tla = Deencapsulation.getField(ContextBootstrap.class,
+         * "threadLocalAccessor");
+         * tla.set(null);
+         */
+        ContextBootstrap.configure(new MockLoggerAdapter(), wireAdapter, new MockThreadLocalAccessor(),
+            new MockContextAccessController(), "guid");
+    }
+
+
+    public static void reset() {
+        try {
+            setStaticField(ContextBootstrap.class, "isConfigured", false);
+            ContextMapHelper.getScopeAwareContextMap().get("true");
+            fail("Should get IllegalStateException");
+        } catch (IllegalStateException e) {
+            // ignored
+        } catch (Exception e) {
+            fail(e.toString());
+        }
+    }
+
+
+    // Reason for following methods: API of JMockit changes with minor versions
+    public static void setStaticField(Class<?> clazz, String fieldName, Object value) {
+        try {
+            Field field = clazz.getDeclaredField(fieldName);
+            field.setAccessible(true);
+            field.set(null, value);
+        } catch (Exception e) {
+            throw new IllegalStateException("Failed to set static field " + fieldName + " of " + clazz + " to " + value, e);
+        }
+    }
+
+    public static void getStaticField(Class<?> clazz, String fieldName) {
+        try {
+            Field field = clazz.getDeclaredField(fieldName);
+            field.setAccessible(true);
+            field.get(null);
+        } catch (Exception e) {
+            throw new IllegalStateException("Failed to get static field " + fieldName + " of " + clazz, e);
+        }
+    }
+
+    public static void setField(Object instance, String fieldName, Object value) {
+        try {
+            Field field = instance.getClass().getDeclaredField(fieldName);
+            FieldReflection.setFieldValue(field, instance, value);
+        } catch (Exception e) {
+            throw new IllegalStateException("Failed to set field " + fieldName + " of " + instance + " to " + value, e);
+        }
+    }
 
 
 
-
+    public static <T> T getField(Object instance, String fieldName) {
+        try {
+            Field field = instance.getClass().getDeclaredField(fieldName);
+            return FieldReflection.getFieldValue(field, instance);
+        } catch (Exception e) {
+            throw new IllegalStateException("Failed to get a value of field " + fieldName + " of " + instance , e);
+        }
+    }
 }
diff --git a/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/adaptors/MockContextAccessController.java b/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/adaptors/MockContextAccessController.java
index 716c987..6f87ce7 100644
--- a/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/adaptors/MockContextAccessController.java
+++ b/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/adaptors/MockContextAccessController.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021 Contributors to the Eclipse Foundation
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v. 2.0, which is available at
@@ -20,20 +21,20 @@
 import org.glassfish.contextpropagation.internal.AccessControlledMap;
 import org.glassfish.contextpropagation.internal.AccessControlledMap.ContextAccessLevel;
 
-public class MockContextAccessController extends
-    ContextAccessController {
+public class MockContextAccessController extends ContextAccessController {
 
-  @Override
-  public boolean isAccessAllowed(String key, AccessControlledMap.ContextAccessLevel type) {
-    if (type == ContextAccessLevel.READ && isEveryoneAllowedToRead(key)) {
-      return true; // First do a quick check for read access
+    @Override
+    public boolean isAccessAllowed(String key, AccessControlledMap.ContextAccessLevel type) {
+        if (type == ContextAccessLevel.READ && isEveryoneAllowedToRead(key)) {
+            return true; // First do a quick check for read access
+        }
+        return true;
     }
-    return true;
-  }
 
-  @Override
-  public boolean isEveryoneAllowedToRead(String key) {
-    return false;
-  }
+
+    @Override
+    public boolean isEveryoneAllowedToRead(String key) {
+        return false;
+    }
 
 }
diff --git a/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/adaptors/MockLoggerAdapter.java b/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/adaptors/MockLoggerAdapter.java
index bf87e81..7eac0f3 100644
--- a/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/adaptors/MockLoggerAdapter.java
+++ b/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/adaptors/MockLoggerAdapter.java
@@ -22,8 +22,8 @@
 
 public class MockLoggerAdapter implements LoggerAdapter {
 
-    // TODO TIP: Change the Level constant to control what is logged, use null to reduce output to a minimum
-    static final Level LOGGING_LEVEL = null; // Level.WARN;
+    // TIP: Change the Level constant to control what is logged, use null to reduce output to a minimum
+    static final Level LOGGING_LEVEL = Level.WARN;
 
     @Override
     public boolean isLoggable(Level level) {
diff --git a/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/adaptors/MockThreadLocalAccessor.java b/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/adaptors/MockThreadLocalAccessor.java
index f68d17c..e393d2c 100644
--- a/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/adaptors/MockThreadLocalAccessor.java
+++ b/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/adaptors/MockThreadLocalAccessor.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021 Contributors to the Eclipse Foundation
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v. 2.0, which is available at
@@ -20,17 +21,18 @@
 import org.glassfish.contextpropagation.internal.AccessControlledMap;
 
 public class MockThreadLocalAccessor implements ThreadLocalAccessor {
-  private ThreadLocal<AccessControlledMap> mapThreadLocal = new ThreadLocal<AccessControlledMap>();
 
-  @Override
-  public void set(AccessControlledMap contextMap) {
-    mapThreadLocal.set(contextMap);
-  }
+    private final ThreadLocal<AccessControlledMap> mapThreadLocal = new ThreadLocal<>();
 
-  @Override
-  public AccessControlledMap get() {
-    //MockLoggerAdapter.debug("Thread: " + Thread.currentThread().getId() + " map: " + mapThreadLocal.get());
-    return mapThreadLocal.get();
-  }
+    @Override
+    public void set(AccessControlledMap contextMap) {
+        mapThreadLocal.set(contextMap);
+    }
 
+
+    @Override
+    public AccessControlledMap get() {
+        MockLoggerAdapter.debug("Thread: " + Thread.currentThread().getId() + " map: " + mapThreadLocal.get());
+        return mapThreadLocal.get();
+    }
 }
diff --git a/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/adaptors/TestableThread.java b/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/adaptors/TestableThread.java
index 947cab5..1f213a6 100644
--- a/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/adaptors/TestableThread.java
+++ b/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/adaptors/TestableThread.java
@@ -17,36 +17,29 @@
 
 package org.glassfish.contextpropagation.adaptors;
 
+import java.util.concurrent.atomic.AtomicReference;
+
 public abstract class TestableThread extends Thread {
 
-    final Throwable[] throwableHolder = new Throwable[1];
+    private final AtomicReference<Throwable> throwableHolder = new AtomicReference<>();
 
-    public TestableThread() {
-        super();
-    }
+    protected abstract void runTest() throws Exception;
 
-
-    @SuppressWarnings("serial")
-    public synchronized void startJoinAndCheckForFailures() {
+    public void startJoinAndCheckForFailures() {
         start();
         try {
             join();
         } catch (InterruptedException e) {
-            throwableHolder[0] = e;
+            throwableHolder.set(e);
         }
-        if (throwableHolder[0] != null) {
-            if (throwableHolder[0] instanceof AssertionError) {
-                throw (AssertionError) throwableHolder[0];
-            } else {
-                throw (RuntimeException) new RuntimeException() {
-
-                    @Override
-                    public String getMessage() {
-                        return throwableHolder[0].getMessage();
-                    }
-                }.initCause(throwableHolder[0]);
-            }
+        Throwable throwable = throwableHolder.get();
+        if (throwable == null) {
+            return;
         }
+        if (throwable instanceof AssertionError) {
+            throw (AssertionError) throwable;
+        }
+        throw new RuntimeException(throwable.getMessage(), throwable);
     }
 
 
@@ -55,10 +48,7 @@
         try {
             runTest();
         } catch (Throwable t) {
-            throwableHolder[0] = t;
+            throwableHolder.set(t);
         }
     }
-
-
-    protected abstract void runTest() throws Exception;
 }
diff --git a/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/internal/AccessControlledMapFinderTest.java b/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/internal/AccessControlledMapFinderTest.java
index aa49325..4e62b05 100644
--- a/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/internal/AccessControlledMapFinderTest.java
+++ b/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/internal/AccessControlledMapFinderTest.java
@@ -17,36 +17,51 @@
 
 package org.glassfish.contextpropagation.internal;
 
+import org.glassfish.contextpropagation.adaptors.BootstrapUtils;
+import org.glassfish.contextpropagation.internal.Utils.AccessControlledMapFinder;
+import org.glassfish.contextpropagation.wireadapters.glassfish.DefaultWireAdapter;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+
 public class AccessControlledMapFinderTest {
-//  static AccessControlledMapFinder mapFinder = new AccessControlledMapFinder();
-//
-//  @Before
-//  public void setup() {
-//    BootstrapUtils.bootstrap(new DefaultWireAdapter());
-//    mapFinder.getMapAndCreateIfNeeded();
-//  }
-//
-//  @Test
-//  public void testGetMapIfItExistsButDoesnt() {
-//    BootstrapUtils.bootstrap(new DefaultWireAdapter());
-//    assertNull(mapFinder.getMapIfItExists());
-//  }
-//
-//  @Test
-//  public void testGetMapIfItExistsWhenItDoes() {
-//    assertNotNull(mapFinder.getMapIfItExists());
-//  }
-//
-//  @Test
-//  public void testCreateMapIfItExistsButDoesnt() {
-//    BootstrapUtils.bootstrap(new DefaultWireAdapter());
-//    assertNull(mapFinder.getMapIfItExists());
-//    assertNotNull(mapFinder.getMapAndCreateIfNeeded());
-//  }
-//
-//  @Test
-//  public void testCreateMapIfItExistsWhenItDoes() {
-//    assertEquals(mapFinder.getMapIfItExists(), mapFinder.getMapAndCreateIfNeeded());
-//  }
+
+    private static AccessControlledMapFinder mapFinder = new AccessControlledMapFinder();
+
+    @BeforeEach
+    public void setup() {
+        BootstrapUtils.bootstrap(new DefaultWireAdapter());
+        mapFinder.getMapAndCreateIfNeeded();
+    }
+
+
+    @Test
+    public void testGetMapIfItExistsButDoesnt() {
+        BootstrapUtils.bootstrap(new DefaultWireAdapter());
+        assertNull(mapFinder.getMapIfItExists());
+    }
+
+
+    @Test
+    public void testGetMapIfItExistsWhenItDoes() {
+        assertNotNull(mapFinder.getMapIfItExists());
+    }
+
+
+    @Test
+    public void testCreateMapIfItExistsButDoesnt() {
+        BootstrapUtils.bootstrap(new DefaultWireAdapter());
+        assertNull(mapFinder.getMapIfItExists());
+        assertNotNull(mapFinder.getMapAndCreateIfNeeded());
+    }
+
+
+    @Test
+    public void testCreateMapIfItExistsWhenItDoes() {
+        assertEquals(mapFinder.getMapIfItExists(), mapFinder.getMapAndCreateIfNeeded());
+    }
 
 }
diff --git a/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/internal/AccessControlledMapTest.java b/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/internal/AccessControlledMapTest.java
index 990e05b..4fc6a2f 100644
--- a/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/internal/AccessControlledMapTest.java
+++ b/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/internal/AccessControlledMapTest.java
@@ -17,164 +17,217 @@
 
 package org.glassfish.contextpropagation.internal;
 
+import java.util.EnumSet;
+import java.util.Iterator;
+
+import org.glassfish.contextpropagation.InsufficientCredentialException;
+import org.glassfish.contextpropagation.PropagationMode;
+import org.glassfish.contextpropagation.adaptors.BootstrapUtils;
+import org.glassfish.contextpropagation.adaptors.MockLoggerAdapter;
+import org.glassfish.contextpropagation.adaptors.MockThreadLocalAccessor;
+import org.glassfish.contextpropagation.bootstrap.ContextAccessController;
+import org.glassfish.contextpropagation.bootstrap.ContextBootstrap;
+import org.glassfish.contextpropagation.internal.AccessControlledMap.ContextAccessLevel;
+import org.glassfish.contextpropagation.internal.Entry.ContextType;
+import org.glassfish.contextpropagation.wireadapters.glassfish.DefaultWireAdapter;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
 public class AccessControlledMapTest {
-//  AccessControlledMap acm;
-//  SimpleMap sm;
-//  final Entry DUMMY_ENTRY = createEntry("dummy", PropagationMode.defaultSet(), ContextType.STRING);
-//
-//  private static Entry createEntry(Object context, EnumSet<PropagationMode> propModes, ContextType ct) {
-//    return new Entry(context, propModes, ct).init(false, false);
-//  }
-//
-//  @BeforeClass
-//  public static void setupClass() {
-//    BootstrapUtils.reset();
-//    ContextBootstrap.configure(new MockLoggerAdapter(),
-//        new DefaultWireAdapter(), new MockThreadLocalAccessor(),
-//        new ContextAccessController() {
-//      @Override
-//      public boolean isAccessAllowed(String key, ContextAccessLevel type) {
-//        switch(type) {
-//        case READ:
-//          return key.contains("read") || key.contains("create") || key.contains("delete") || key.contains("update");
-//        case CREATE:
-//          return key.contains("create");
-//        case DELETE:
-//          return key.contains("delete");
-//        case UPDATE:
-//          return key.contains("update");
-//        }
-//        return false;
-//      }
-//      @Override
-//      public boolean isEveryoneAllowedToRead(String key) {
-//        if ("put".equals(Thread.currentThread().getStackTrace()[2].getMethodName())) {
-//          return true;
-//        } else {
-//          throw new UnsupportedOperationException();
-//        }
-//      }
-//    }, "guid");
-//  }
-//
-//  @Before
-//  public void setup()  {
-//    acm = new AccessControlledMap();
-//    sm = acm.simpleMap;
-//    sm.put("noAccess", createEntry("noAccessString", PropagationMode.defaultSet(), ContextType.STRING));
-//    sm.put("readOnly", createEntry("readOnlyString", PropagationMode.defaultSet(), ContextType.STRING));
-//    sm.put("readableByAll", createEntry("readableByAllString", PropagationMode.defaultSet(), ContextType.STRING).init(true, true));
-//  }
-//
-//  @Test(expected=InsufficientCredentialException.class)
-//  public void testGetNoAccess() throws InsufficientCredentialException {
-//    acm.get("noAccess");
-//  }
-//
-//  @Test
-//  public void testGetAllCanRead() throws InsufficientCredentialException {
-//    assertNotNull(acm.get("readableByAll"));
-//  }
-//
-//  @Test
-//  public void testGet() throws InsufficientCredentialException {
-//    assertNotNull(acm.get("readOnly"));
-//  }
-//
-//  @Test(expected=InsufficientCredentialException.class)
-//  public void testGetNoexistent() throws InsufficientCredentialException {
-//    acm.get("noexistent");
-//  }
-//
-//  @Test
-//  public void testPutReplacePermitted() throws InsufficientCredentialException {
-//    sm.put("update", DUMMY_ENTRY);
-//    assertNotNull(acm.put("update", DUMMY_ENTRY));
-//  }
-//
-//  @Test(expected=InsufficientCredentialException.class)
-//  public void testPutReplaceNotPermitted() throws InsufficientCredentialException {
-//    acm.put("readOnly", DUMMY_ENTRY);
-//  }
-//
-//  @Test
-//  public void testPutCreatePermitted() throws InsufficientCredentialException {
-//    assertNull(acm.put("create", DUMMY_ENTRY));
-//  }
-//
-//  @Test(expected=InsufficientCredentialException.class)
-//  public void testPutCreateNoPermitted() throws InsufficientCredentialException {
-//    acm.put("readOnlyNew", DUMMY_ENTRY);
-//  }
-//
-//  @Test
-//  public void testRemovePermitted() throws InsufficientCredentialException {
-//    sm.put("deleteMe", createEntry("deleteMe", PropagationMode.defaultSet(), ContextType.STRING));
-//    assertNotNull(acm.remove("deleteMe"));
-//  }
-//
-//  @Test(expected=InsufficientCredentialException.class)
-//  public void testRemoveNotPermitted() throws InsufficientCredentialException {
-//    acm.remove("readOnly");
-//  }
-//
-//  @Test
-//  public void testRemovePermittedNonExistent() throws InsufficientCredentialException {
-//    assertNull(acm.remove("deleteNonExistent"));
-//  }
-//
-//  @Test(expected=InsufficientCredentialException.class) // We would rather throw than return null and indicate that there is no entry by that name
-//  public void testRemoveNonPermittedNonExistent() throws InsufficientCredentialException {
-//    acm.remove("readOnlyNonExistent");
-//  }
-//
-//  @Test(expected=InsufficientCredentialException.class)
-//  public void testGetPropagationModesNoAccess() throws InsufficientCredentialException {
-//    acm.getPropagationModes("noAccess");
-//  }
-//
-//  @Test
-//  public void testGetPropagationModesAllCanRead() throws InsufficientCredentialException {
-//    assertNotNull(acm.getPropagationModes("readableByAll"));
-//  }
-//
-//  @Test
-//  public void testGetPropagationModes() throws InsufficientCredentialException {
-//    assertNotNull(acm.getPropagationModes("readOnly"));
-//  }
-//
-//  @Test(expected=InsufficientCredentialException.class)
-//  public void testGetPropagationModesNoexistent() throws InsufficientCredentialException {
-//    acm.getPropagationModes("noexistent");
-//  }
-//
-//  @Test
-//  public void testNamesEmpty() {
-//    sm.map.clear();
-//    assertFalse(acm.names().hasNext());
-//  }
-//
-//  @Test
-//  public void testNamesAllUnaccessible() {
-//    sm.map.clear();
-//    sm.put("hidden1", DUMMY_ENTRY);
-//    sm.put("hidden1", DUMMY_ENTRY);
-//    assertFalse(acm.names().hasNext());
-//  }
-//
-//  @Test
-//  public void testNamesSomeVisible() {
-//    sm.map.clear();
-//    sm.put("hidden1", DUMMY_ENTRY);
-//    sm.put("hidden1", DUMMY_ENTRY);
-//    sm.put("readOnly", DUMMY_ENTRY);
-//    sm.put("delete", DUMMY_ENTRY);
-//    sm.put("create", DUMMY_ENTRY);
-//    sm.put("update", DUMMY_ENTRY);
-//    Iterator<?> iter = acm.names();
-//    int count = 0;
-//    while(iter.hasNext()) { iter.next(); count++; }
-//    assertEquals(4, count);
-//  }
+
+    private AccessControlledMap acm;
+    private SimpleMap sm;
+    private final Entry DUMMY_ENTRY = createEntry("dummy", PropagationMode.defaultSet(), ContextType.STRING);
+
+    private static Entry createEntry(Object context, EnumSet<PropagationMode> propModes, ContextType ct) {
+        return new Entry(context, propModes, ct).init(false, false);
+    }
+
+
+    @BeforeAll
+    public static void setupClass() {
+        BootstrapUtils.reset();
+        ContextBootstrap.configure(new MockLoggerAdapter(), new DefaultWireAdapter(), new MockThreadLocalAccessor(),
+            new ContextAccessController() {
+
+                @Override
+                public boolean isAccessAllowed(String key, ContextAccessLevel type) {
+                    switch (type) {
+                        case READ:
+                            return key.contains("read") || key.contains("create") || key.contains("delete")
+                                || key.contains("update");
+                        case CREATE:
+                            return key.contains("create");
+                        case DELETE:
+                            return key.contains("delete");
+                        case UPDATE:
+                            return key.contains("update");
+                    }
+                    return false;
+                }
+
+
+                @Override
+                public boolean isEveryoneAllowedToRead(String key) {
+                    if ("put".equals(Thread.currentThread().getStackTrace()[2].getMethodName())) {
+                        return true;
+                    } else {
+                        throw new UnsupportedOperationException();
+                    }
+                }
+            }, "guid");
+    }
+
+
+    @BeforeEach
+    public void setup() {
+        acm = new AccessControlledMap();
+        sm = acm.simpleMap;
+        sm.put("noAccess", createEntry("noAccessString", PropagationMode.defaultSet(), ContextType.STRING));
+        sm.put("readOnly", createEntry("readOnlyString", PropagationMode.defaultSet(), ContextType.STRING));
+        sm.put("readableByAll",
+            createEntry("readableByAllString", PropagationMode.defaultSet(), ContextType.STRING).init(true, true));
+    }
+
+
+    @Test
+    public void testGetNoAccess() throws InsufficientCredentialException {
+        assertThrows(InsufficientCredentialException.class, () -> acm.get("noAccess"));
+    }
+
+
+    @Test
+    public void testGetAllCanRead() throws InsufficientCredentialException {
+        assertNotNull(acm.get("readableByAll"));
+    }
+
+
+    @Test
+    public void testGet() throws InsufficientCredentialException {
+        assertNotNull(acm.get("readOnly"));
+    }
+
+
+    @Test
+    public void testGetNoexistent() throws InsufficientCredentialException {
+        assertThrows(InsufficientCredentialException.class, () -> acm.get("noexistent"));
+    }
+
+
+    @Test
+    public void testPutReplacePermitted() throws InsufficientCredentialException {
+        sm.put("update", DUMMY_ENTRY);
+        assertNotNull(acm.put("update", DUMMY_ENTRY));
+    }
+
+
+    @Test
+    public void testPutReplaceNotPermitted() throws InsufficientCredentialException {
+        assertThrows(InsufficientCredentialException.class, () -> acm.put("readOnly", DUMMY_ENTRY));
+    }
+
+
+    @Test
+    public void testPutCreatePermitted() throws InsufficientCredentialException {
+        assertNull(acm.put("create", DUMMY_ENTRY));
+    }
+
+
+    @Test
+    public void testPutCreateNoPermitted() throws InsufficientCredentialException {
+        assertThrows(InsufficientCredentialException.class, () -> acm.put("readOnlyNew", DUMMY_ENTRY));
+    }
+
+
+    @Test
+    public void testRemovePermitted() throws InsufficientCredentialException {
+        sm.put("deleteMe", createEntry("deleteMe", PropagationMode.defaultSet(), ContextType.STRING));
+        assertNotNull(acm.remove("deleteMe"));
+    }
+
+
+    @Test
+    public void testRemoveNotPermitted() throws InsufficientCredentialException {
+        assertThrows(InsufficientCredentialException.class, () -> acm.remove("readOnly"));
+    }
+
+
+    @Test
+    public void testRemovePermittedNonExistent() throws InsufficientCredentialException {
+        assertNull(acm.remove("deleteNonExistent"));
+    }
+
+
+    @Test
+    // We would rather throw than return null and indicate that there is no entry by that name
+    public void testRemoveNonPermittedNonExistent() throws InsufficientCredentialException {
+        assertThrows(InsufficientCredentialException.class, () -> acm.remove("readOnlyNonExistent"));
+    }
+
+
+    @Test
+    public void testGetPropagationModesNoAccess() throws InsufficientCredentialException {
+        assertThrows(InsufficientCredentialException.class, () -> acm.getPropagationModes("noAccess"));
+    }
+
+
+    @Test
+    public void testGetPropagationModesAllCanRead() throws InsufficientCredentialException {
+        assertNotNull(acm.getPropagationModes("readableByAll"));
+    }
+
+
+    @Test
+    public void testGetPropagationModes() throws InsufficientCredentialException {
+        assertNotNull(acm.getPropagationModes("readOnly"));
+    }
+
+
+    @Test
+    public void testGetPropagationModesNoexistent() throws InsufficientCredentialException {
+        assertThrows(InsufficientCredentialException.class, () -> acm.getPropagationModes("noexistent"));
+    }
+
+
+    @Test
+    public void testNamesEmpty() {
+        sm.map.clear();
+        assertFalse(acm.names().hasNext());
+    }
+
+
+    @Test
+    public void testNamesAllUnaccessible() {
+        sm.map.clear();
+        sm.put("hidden1", DUMMY_ENTRY);
+        sm.put("hidden1", DUMMY_ENTRY);
+        assertFalse(acm.names().hasNext());
+    }
+
+
+    @Test
+    public void testNamesSomeVisible() {
+        sm.map.clear();
+        sm.put("hidden1", DUMMY_ENTRY);
+        sm.put("hidden1", DUMMY_ENTRY);
+        sm.put("readOnly", DUMMY_ENTRY);
+        sm.put("delete", DUMMY_ENTRY);
+        sm.put("create", DUMMY_ENTRY);
+        sm.put("update", DUMMY_ENTRY);
+        Iterator<?> iter = acm.names();
+        int count = 0;
+        while (iter.hasNext()) {
+            iter.next();
+            count++;
+        }
+        assertEquals(4, count);
+    }
 
 }
diff --git a/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/internal/ContextMapImplTest.java b/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/internal/ContextMapImplTest.java
index 305a30e..fc8bfa8 100644
--- a/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/internal/ContextMapImplTest.java
+++ b/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/internal/ContextMapImplTest.java
@@ -17,159 +17,194 @@
 
 package org.glassfish.contextpropagation.internal;
 
+import java.util.EnumSet;
+import java.util.Iterator;
+
+import org.glassfish.contextpropagation.ContextMap;
+import org.glassfish.contextpropagation.ContextViewFactory;
+import org.glassfish.contextpropagation.InsufficientCredentialException;
+import org.glassfish.contextpropagation.Location;
+import org.glassfish.contextpropagation.PropagationMode;
+import org.glassfish.contextpropagation.View;
+import org.glassfish.contextpropagation.ViewCapable;
+import org.glassfish.contextpropagation.adaptors.BootstrapUtils;
+import org.glassfish.contextpropagation.adaptors.MockLoggerAdapter;
+import org.glassfish.contextpropagation.internal.Entry.ContextType;
+import org.glassfish.contextpropagation.internal.Utils.AccessControlledMapFinder;
+import org.glassfish.contextpropagation.spi.ContextMapHelper;
+import org.glassfish.contextpropagation.wireadapters.glassfish.DefaultWireAdapter;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.glassfish.contextpropagation.adaptors.BootstrapUtils.*;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.equalTo;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
 public class ContextMapImplTest {
-//  private static Entry DUMMY_ENTRY;
-//  private static EnumSet<PropagationMode> PROP_MODES = PropagationMode.defaultSet();
-//  static ContextMap cm;
-//  static AccessControlledMap acMap, savedMap;
-//  static AccessControlledMapFinder mapFinder = new AccessControlledMapFinder() {
-//    @Override
-//    protected AccessControlledMap getMapIfItExists() {
-//      AccessControlledMap map = super.getMapIfItExists();
-//      return map == null ? acMap : map;
-//    }
-//  };
-//
-//  @BeforeClass
-//  public static void setupClass() {
-//    BootstrapUtils.bootstrap(new DefaultWireAdapter());
-//    DUMMY_ENTRY =
-//        new Entry("dummy", PropagationMode.defaultSet(), ContextType.STRING).init(true, true);
-//    savedMap = new AccessControlledMap();
-//    Deencapsulation.setField(Utils.class, "mapFinder", mapFinder);
-//    cm = Utils.getScopeAwareContextMap();
-//    savedMap.simpleMap.put("key", DUMMY_ENTRY);
-//    savedMap.simpleMap.put("removeMe", DUMMY_ENTRY);
-//    savedMap.simpleMap.put(Location.KEY,
-//        new Entry(new Location(new ViewImpl(Location.KEY)){},
-//            PropagationMode.defaultSet(),
-//            ContextType.VIEW_CAPABLE).init(true, true));
-//  }
-//
-//  @Before
-//  public void setup() {
-//    BootstrapUtils.bootstrap(new DefaultWireAdapter());
-//  }
-//
-//  @Test
-//  public void testGet() throws InsufficientCredentialException {
-//    acMap = null;
-//    assertNull(cm.get("key"));
-//    acMap = savedMap;
-//    assertEquals("dummy", cm.get("key"));
-//  }
-//
-//  @Test
-//  public void testPutString() throws InsufficientCredentialException {
-//    checkPut("a String", "string", "new string", "put");
-//  }
-//
-//  protected void checkPut(String key, Object origContext, Object newContext, String methodName) throws InsufficientCredentialException {
-//    acMap = null;
-//    Deencapsulation.invoke(cm, "put", key, origContext, PROP_MODES);
-//    assertNotNull(mapFinder.getMapIfItExists());
-//    assertEquals(origContext, mapFinder.getMapIfItExists().get(key));
-//    assertTrue(PROP_MODES == mapFinder.getMapIfItExists().getPropagationModes(key));
-//    assertEquals(origContext, Deencapsulation.invoke(cm, methodName, key, newContext, PROP_MODES));
-//  }
-//
-//  @Test
-//  public void testPutAscii() throws InsufficientCredentialException {
-//    checkPut("an ascii String", "ascii string", "new string", "putAscii");
-//  }
-//
-//  @Test
-//  public void testPutNumber() throws InsufficientCredentialException {
-//    checkPut("a long", 1L, 2L, "put");
-//  }
-//
-//  @Test
-//  public void testPutBoolean() throws InsufficientCredentialException {
-//    checkPut("a boolean", true, false, "put");
-//  }
-//
-//  @Test
-//  public void testCreateViewCapable() throws InsufficientCredentialException {
-//    acMap = savedMap;
-//    String prefix = "a view capable";
-//    ContextMapHelper.registerContextFactoryForPrefixNamed(prefix,
-//        new ContextViewFactory() {
-//          @Override
-//          public EnumSet<PropagationMode> getPropagationModes() {
-//             return PropagationMode.defaultSet();
-//          }
-//          @Override
-//          public ViewCapable createInstance(View view) {
-//            return new ViewCapable() { /* dummy instance */};
-//          }
-//        });
-//    assertNotNull(cm.createViewCapable(prefix));
-//  }
-//
-//  @Test
-//  public void testPutSerializable() throws InsufficientCredentialException {
-//    checkPut("a Serializable", "serializable", "new serializable", "putSerializable");
-//  }
-//
-//  @Test
-//  public void testGetPropagationModes() throws InsufficientCredentialException {
-//    acMap = null;
-//    assertNull(cm.getPropagationModes("key"));
-//    acMap = savedMap;
-//    assertEquals(PropagationMode.defaultSet(), cm.getPropagationModes("key"));
-//  }
-//
-//  @Test
-//  public void testRemove() throws InsufficientCredentialException {
-//    acMap = savedMap;
-//    assertNull(cm.remove("nonexistent"));
-//    assertNotNull(cm.remove("removeMe"));
-//  }
-//
-//  @Test
-//  public void testPutCharacter() throws InsufficientCredentialException {
-//    checkPut("a Character", 'c', 'd', "put");
-//  }
-//
-//  @Ignore@Test(expected=AssertionError.class) // TODO re-evaluate this test
-//  public void testGetLocationBeforeItIsSet1() {
-//    acMap = null;
-//    cm.getLocation();
-//  }
-//
-//  @Ignore@Test(expected=AssertionError.class) // TODO re-evaluate this test
-//  public void testGetLocationBeforeItIsSet2() {
-//    acMap = new AccessControlledMap();
-//    cm.getLocation();
-//  }
-//
-//  @Test
-//  public void testGetLocationNormalCase() {
-//    acMap = savedMap;
-//    Location location = cm.getLocation();
-//    assertNotNull(location);
-//  }
-//
-//  @Test
-//  public void testIsEmpty() {
-//    acMap = null;
-//    assertTrue(cm.isEmpty());
-//    acMap = new AccessControlledMap();
-//    assertTrue(cm.isEmpty());
-//    acMap = savedMap;
-//    assertFalse(cm.isEmpty());
-//  }
-//
-//  @Test
-//  public void testNames() {
-//    acMap = null;
-//    Iterator<?> iter = cm.names();
-//    assertNull(iter);
-//    acMap = savedMap;
-//    iter = cm.names();
-//    while (iter.hasNext()) {
-//      MockLoggerAdapter.debug((String) iter.next());
-//    }
-//  }
+
+    private static Entry DUMMY_ENTRY;
+    private static EnumSet<PropagationMode> PROP_MODES = PropagationMode.defaultSet();
+    private static ContextMap cm;
+    private static AccessControlledMap acMap;
+    private static AccessControlledMap savedMap;
+    static AccessControlledMapFinder mapFinder = new AccessControlledMapFinder() {
+
+        @Override
+        protected AccessControlledMap getMapIfItExists() {
+            AccessControlledMap map = super.getMapIfItExists();
+            return map == null ? acMap : map;
+        }
+    };
+
+    @BeforeAll
+    public static void setupClass() {
+        BootstrapUtils.bootstrap(new DefaultWireAdapter());
+        DUMMY_ENTRY = new Entry("dummy", PropagationMode.defaultSet(), ContextType.STRING).init(true, true);
+        savedMap = new AccessControlledMap();
+        setStaticField(Utils.class, "mapFinder", mapFinder);
+        cm = Utils.getScopeAwareContextMap();
+        savedMap.simpleMap.put("key", DUMMY_ENTRY);
+        savedMap.simpleMap.put("removeMe", DUMMY_ENTRY);
+        Entry entry = new Entry(new Location(new ViewImpl(Location.KEY)) {
+        }, PropagationMode.defaultSet(), ContextType.VIEW_CAPABLE).init(true, true);
+        savedMap.simpleMap.put(Location.KEY, entry);
+    }
+
+
+    @BeforeEach
+    public void setup() {
+        BootstrapUtils.bootstrap(new DefaultWireAdapter());
+        acMap = null;
+    }
+
+
+    @Test
+    public void testGet() throws InsufficientCredentialException {
+        assertNull(cm.get("key"));
+        acMap = savedMap;
+        assertEquals("dummy", cm.get("key"));
+    }
+
+
+    @Test
+    public void testPutString() throws InsufficientCredentialException {
+        String key = "a String";
+        String origContext = "string";
+        cm.put(key, origContext, PROP_MODES);
+        checkPut(key, origContext);
+        assertEquals(origContext, cm.put(key, "new string", PROP_MODES));
+    }
+
+
+    protected void checkPut(String key, Object origContext) throws InsufficientCredentialException {
+        assertNotNull(mapFinder.getMapIfItExists());
+        assertEquals(origContext, mapFinder.getMapIfItExists().get(key));
+        assertSame(PROP_MODES, mapFinder.getMapIfItExists().getPropagationModes(key));
+    }
+
+
+    @Test
+    public void testPutNumber() throws InsufficientCredentialException {
+        String key = "a long";
+        long origContext = 1L;
+        cm.put(key, origContext, PROP_MODES);
+        checkPut(key, origContext);
+        assertThat(cm.put(key, 2L, PROP_MODES), equalTo(origContext));
+    }
+
+
+    @Test
+    public void testPutBoolean() throws InsufficientCredentialException {
+        String key = "a boolean";
+        boolean origContext = true;
+        cm.put(key, origContext, PROP_MODES);
+        checkPut(key, origContext);
+        assertThat(cm.put(key, false, PROP_MODES), equalTo(origContext));
+    }
+
+
+    @Test
+    public void testCreateViewCapable() throws InsufficientCredentialException {
+        acMap = savedMap;
+        String prefix = "a view capable";
+        ContextMapHelper.registerContextFactoryForPrefixNamed(prefix, new ContextViewFactory() {
+
+            @Override
+            public EnumSet<PropagationMode> getPropagationModes() {
+                return PropagationMode.defaultSet();
+            }
+
+
+            @Override
+            public ViewCapable createInstance(View view) {
+                return new ViewCapable() {
+                    /* dummy instance */};
+            }
+        });
+        assertNotNull(cm.createViewCapable(prefix));
+    }
+
+
+    @Test
+    public void testGetPropagationModes() throws InsufficientCredentialException {
+        assertNull(cm.getPropagationModes("key"));
+        acMap = savedMap;
+        assertEquals(PropagationMode.defaultSet(), cm.getPropagationModes("key"));
+    }
+
+
+    @Test
+    public void testRemove() throws InsufficientCredentialException {
+        acMap = savedMap;
+        assertNull(cm.remove("nonexistent"));
+        assertNotNull(cm.remove("removeMe"));
+    }
+
+
+    @Test
+    public void testPutCharacter() throws InsufficientCredentialException {
+        String key = "a Character";
+        char origContext = 'c';
+        cm.put(key, origContext, PROP_MODES);
+        checkPut(key, origContext);
+        assertThat(cm.put(key, 'd', PROP_MODES), equalTo(origContext));
+    }
+
+
+    @Test
+    public void testGetLocationNormalCase() {
+        acMap = savedMap;
+        Location location = cm.getLocation();
+        assertNotNull(location);
+    }
+
+
+    @Test
+    public void testIsEmpty() {
+        assertTrue(cm.isEmpty());
+        acMap = new AccessControlledMap();
+        assertTrue(cm.isEmpty());
+        acMap = savedMap;
+        assertFalse(cm.isEmpty());
+    }
+
+
+    @Test
+    public void testNames() {
+        Iterator<?> iter = cm.names();
+        assertNull(iter);
+        acMap = savedMap;
+        iter = cm.names();
+        while (iter.hasNext()) {
+            MockLoggerAdapter.debug((String) iter.next());
+        }
+    }
 
 }
diff --git a/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/internal/ContextMapPropagatorTest.java b/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/internal/ContextMapPropagatorTest.java
index e625829..82bc170 100644
--- a/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/internal/ContextMapPropagatorTest.java
+++ b/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/internal/ContextMapPropagatorTest.java
@@ -17,16 +17,34 @@
 
 package org.glassfish.contextpropagation.internal;
 
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.EnumSet;
+
+import org.glassfish.contextpropagation.ContextMap;
+import org.glassfish.contextpropagation.Location;
+import org.glassfish.contextpropagation.PropagationMode;
+import org.glassfish.contextpropagation.adaptors.BootstrapUtils;
+import org.glassfish.contextpropagation.adaptors.TestableThread;
+import org.glassfish.contextpropagation.internal.Entry.ContextType;
+import org.glassfish.contextpropagation.internal.Utils.AccessControlledMapFinder;
+import org.glassfish.contextpropagation.spi.ContextMapPropagator;
+import org.glassfish.contextpropagation.wireadapters.WireAdapter;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.ExtendWith;
 
+import mockit.Expectations;
+import mockit.Mocked;
 import mockit.integration.junit5.JMockitExtension;
 
-//import mockit.Deencapsulation;
-/*import mockit.Expectations;
-import mockit.Mocked;
-import mockit.NonStrictExpectations;
-import mockit.integration.junit4.JMockit;*/
-
+import static org.junit.jupiter.api.Assertions.assertAll;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNotSame;
+import static org.junit.jupiter.api.Assertions.assertNull;
 
 
 /**
@@ -34,165 +52,215 @@
  */
 @ExtendWith(JMockitExtension.class)
 public class ContextMapPropagatorTest {
-//  ContextMapPropagator propagator;
-//  ContextMap cm;
-//  SimpleMap sm;
-//  //@Mocked(realClassName="org.glassfish.contextpropagation.wireadapters.glassfish.DefaultWireAdapter")
-//  final WireAdapter adapter = new DefaultWireAdapter();
-//  Entry defaultEntry, rmiEntry, soapEntry;
-//  final OutputStream out = new ByteArrayOutputStream();
-//
-//  @Before
-//  public void setup() throws InsufficientCredentialException {
-//    BootstrapUtils.bootstrap(adapter);
-//    propagator = Utils.getScopeAwarePropagator();
-//    cm = Utils.getScopeAwareContextMap();
-//    EnumSet<PropagationMode> oneWayDefault = PropagationMode.defaultSet();
-//    oneWayDefault.add(PropagationMode.ONEWAY);
-//    cm.put("default", "default value", oneWayDefault); // Only sent in the request
-//    cm.put("rmi", "rmi value", EnumSet.of(PropagationMode.RMI));
-//    cm.put("soap", "soap value", EnumSet.of(PropagationMode.SOAP));
-//    Utils.AccessControlledMapFinder acmFinder = Deencapsulation.getField(Utils.class, "mapFinder");
-//    sm = acmFinder.getMapIfItExists().simpleMap;
-//    defaultEntry = sm.getEntry("default");
-//    rmiEntry = sm.getEntry("rmi");
-//    soapEntry = sm.getEntry("soap");
-//  }
-//
-//  @Test
-//  public void testSendRequest() throws IOException, InsufficientCredentialException {
-////    new Expectations() {
-////      {
-////        adapter.prepareToWriteTo(out);
-////        adapter.write("default", defaultEntry);
-////        adapter.write("rmi", rmiEntry);
-////        adapter.flush();
-////      }
-////    };
-//    propagator.sendRequest(out, PropagationMode.RMI);
-//  }
-//
-//  @Ignore("jmockit fails without providing a reason")@Test // TODO re-evaluate this test
-//  public void testSendRequestWithLocation() throws IOException, InsufficientCredentialException {
-//    final Entry locationEntry = setupLocation();
-////    new Expectations() {
-////      {
-////        adapter.prepareToWriteTo(out);
-////        adapter.write(Location.KEY, locationEntry); // the order to location calls may have changed since we no longer write it first.
-////        adapter.write("default", defaultEntry);
-////        //adapter.write(Location.KEY + ".locationId", (Entry) any);
-////        //adapter.write(Location.KEY + ".origin", (Entry) any);
-////        adapter.write("rmi", rmiEntry);
-////        adapter.flush();
-////      }
-////    };
-//    propagator.sendRequest(out, PropagationMode.RMI);
-//  }
-//
-//  protected Entry setupLocation() {
-//    final Entry locationEntry = new Entry(new Location(new ViewImpl(Location.KEY)) {},
-//        Location.PROP_MODES, ContextType.VIEW_CAPABLE).init(true, false);
-//    sm.put(Location.KEY, locationEntry);
-//    return locationEntry;
-//  }
-//
-//  @Test
-//  public void testSendResponse() throws IOException {
-////    new Expectations() {
-////      {
-////        adapter.prepareToWriteTo(out);
-////        // default is not expected because it has propagation mode ONEWAY
-////        adapter.write("rmi", rmiEntry);
-////        adapter.flush();
-////      }
-////    };
-//    propagator.sendResponse(out, PropagationMode.RMI);
-//  }
-//
-//  @Test
-//  public void testSendResponseWithLocation() throws IOException {
-//    setupLocation();
-////    new Expectations() {
-////      {
-////        adapter.prepareToWriteTo(out);
-////        // Location is not expected for responses
-////        // default is not expected because it has propagation mode ONEWAY
-////        adapter.write("rmi", rmiEntry);
-////        adapter.flush();
-////      }
-////    };
-//    propagator.sendResponse(out, PropagationMode.RMI);
-//  }
-//
-//  final static InputStream NOOPInputStream = new InputStream() {
-//    @Override public int read() throws IOException {
-//      return 0;
-//    }
-//  };
-//
-//  @Test
-//  public void testReceiveRequestBehavior() throws IOException, ClassNotFoundException {
-//    checkReceiveBehavior("receiveRequest", NOOPInputStream);
-//  }
-//
-//  protected void checkReceiveBehavior(String methodName, Object... args) throws IOException,
-//  ClassNotFoundException {
-//
-////    new Expectations() {
-////      {
-////        adapter.prepareToReadFrom(NOOPInputStream);
-////        adapter.readKey(); result = "default";
-////        adapter.readEntry(); result = defaultEntry;
-////        adapter.readKey(); result = "rmi";
-////        adapter.readEntry(); result = rmiEntry;
-////        adapter.readKey(); result = "soap";
-////        adapter.readEntry(); result = soapEntry;
-////        adapter.readKey(); result = null;
-////      }
-////    };
-//    Deencapsulation.invoke(propagator, methodName, args);
-//  }
-//
-//  @Test
-//  public void testReceiveResponse() throws IOException, ClassNotFoundException {
-//    checkReceiveBehavior("receiveResponse", NOOPInputStream, PropagationMode.SOAP);
-//  }
-//
-//  @Test
-//  public void testRestoreThreadContexts() throws InsufficientCredentialException, InterruptedException {
-//    cm.put("local", "local context", EnumSet.of(PropagationMode.LOCAL)); // This one should not propagate since it is LOCAL
-//    final AccessControlledMap acm = cm.getAccessControlledMap();
-//    new TestableThread() {
-//      @Override
-//      public void runTest() throws Exception {
-//        propagator.restoreThreadContexts(acm);
-//        ContextMap newCM = Utils.getScopeAwareContextMap();
-//        assertNotSame(cm, newCM);
-//        assertNull(newCM.get("local"));
-//        assertNotNull(newCM.get("default"));
-//        assertNull(newCM.get("soap")); // Does not have the PropagationMode.THREAD
-//        assertNull(newCM.get("rmi")); // Does not have the PropagationMode.THREAD
-//      }
-//    }.startJoinAndCheckForFailures();
-//  }
-//
-//  public void testUseWireAdapter(final WireAdapter wa) throws IOException {
-//    assertTrue(wa != adapter);
-//    propagator.useWireAdapter(wa);
-////    new NonStrictExpectations() {{
-////      wa.prepareToWriteTo((OutputStream) withNotNull()); times = 1;
-////    }};
-//    propagator.sendRequest(out, PropagationMode.RMI);
-//  }
-//
-//  @Test public void clearPropagatedEntries() throws InsufficientCredentialException {
-//    assertEquals(defaultEntry.value, cm.get("default"));
-//    assertEquals(rmiEntry.value, cm.get("rmi"));
-//    assertEquals(soapEntry.value, cm.get("soap"));
-//    Deencapsulation.invoke(propagator, "clearPropagatedEntries", PropagationMode.ONEWAY, sm);
-//    assertNull(cm.get("default")); // The only ONEWAY item
-//    assertNotNull(cm.get("rmi"));
-//    assertNotNull(cm.get("soap"));
-//  }
 
+    @Mocked
+    private WireAdapter adapter;
+    private ContextMapPropagator propagator;
+    private ContextMap contextMap;
+    private SimpleMap simpleMap;
+    private Entry defaultEntry;
+    private Entry rmiEntry;
+    private Entry soapEntry;
+    private final OutputStream out = new ByteArrayOutputStream();
+
+    private static final InputStream NOOP_INPUT_STREAM = new InputStream() {
+
+        @Override
+        public int read() throws IOException {
+            return 0;
+        }
+    };
+
+    @BeforeEach
+    public void setup() throws Exception {
+        BootstrapUtils.bootstrap(adapter);
+        propagator = Utils.getScopeAwarePropagator();
+        propagator.useWireAdapter(adapter);
+        contextMap = Utils.getScopeAwareContextMap();
+        EnumSet<PropagationMode> oneWayDefault = PropagationMode.defaultSet();
+        oneWayDefault.add(PropagationMode.ONEWAY);
+        // Only sent in the request
+        contextMap.put("default", "default value", oneWayDefault);
+        contextMap.put("rmi", "rmi value", EnumSet.of(PropagationMode.RMI));
+        contextMap.put("soap", "soap value", EnumSet.of(PropagationMode.SOAP));
+        AccessControlledMapFinder acmFinder = new AccessControlledMapFinder();
+        simpleMap = acmFinder.getMapAndCreateIfNeeded().simpleMap;
+        defaultEntry = simpleMap.getEntry("default");
+        rmiEntry = simpleMap.getEntry("rmi");
+        soapEntry = simpleMap.getEntry("soap");
+    }
+
+
+    @Test
+    public void testSendRequest() throws Exception {
+        new Expectations() {
+
+            {
+                adapter.prepareToWriteTo(out);
+                adapter.write("default", defaultEntry);
+                adapter.write("rmi", rmiEntry);
+                adapter.flush();
+            }
+        };
+        propagator.sendRequest(out, PropagationMode.RMI);
+    }
+
+
+    @Test
+    @Disabled("Causes ConcurrentModificationException at SimpleMap.findNext:162")
+    public void testSendRequestWithLocation() throws Exception {
+        final Entry locationEntry = createLocationEntry();
+        new Expectations() {
+
+            {
+                adapter.prepareToWriteTo(out);
+                adapter.write(Location.KEY, locationEntry);
+                // the order to location calls may have changed since we no longer write it first.
+                adapter.write("default", defaultEntry);
+                adapter.write(Location.KEY + ".locationId", (Entry) any);
+                adapter.write(Location.KEY + ".origin", (Entry) any);
+                adapter.write("rmi", rmiEntry);
+                adapter.flush();
+            }
+        };
+        propagator.sendRequest(out, PropagationMode.RMI);
+    }
+
+
+    @Test
+    public void testSendResponse() throws IOException {
+        new Expectations() {
+
+            {
+                adapter.prepareToWriteTo(out);
+                // default is not expected because it has propagation mode ONEWAY
+                adapter.write("rmi", rmiEntry);
+                adapter.flush();
+            }
+        };
+        propagator.sendResponse(out, PropagationMode.RMI);
+    }
+
+
+    @Test
+    public void testSendResponseWithLocation() throws IOException {
+        createLocationEntry();
+        new Expectations() {
+
+            {
+                adapter.prepareToWriteTo(out);
+                // Location is not expected for responses
+                // default is not expected because it has propagation mode ONEWAY
+                adapter.write("rmi", rmiEntry);
+                adapter.flush();
+            }
+        };
+        propagator.sendResponse(out, PropagationMode.RMI);
+    }
+
+
+    @Test
+    @Disabled("Incompatible Jmockit 1.49 and JaCoCo 0.8.7, also readEntry after 'soap' still fails even without jacoco")
+    public void testReceiveRequestBehavior() throws Exception {
+        new Expectations() {
+
+            {
+                adapter.prepareToReadFrom(NOOP_INPUT_STREAM);
+                adapter.readKey();
+                result = "default";
+                adapter.readEntry();
+                result = defaultEntry;
+                adapter.readKey();
+                result = "rmi";
+                adapter.readEntry();
+                result = rmiEntry;
+                adapter.readKey();
+                result = "soap";
+                adapter.readEntry();
+                result = soapEntry;
+                adapter.readKey();
+                result = null;
+            }
+        };
+        propagator.receiveRequest(NOOP_INPUT_STREAM);
+    }
+
+
+    @Test
+    @Disabled("Incompatible Jmockit 1.49 and JaCoCo 0.8.7, also readEntry after 'soap' still fails even without jacoco")
+    public void testReceiveResponse() throws Exception {
+        new Expectations() {
+
+            {
+                adapter.prepareToReadFrom(NOOP_INPUT_STREAM);
+                adapter.readKey();
+                result = "default";
+
+                adapter.readEntry();
+                result = defaultEntry;
+
+                adapter.readKey();
+                result = "rmi";
+
+                adapter.readEntry();
+                result = rmiEntry;
+
+                adapter.readKey();
+                result = "soap";
+
+                adapter.readEntry();
+                result = soapEntry;
+
+                adapter.readKey();
+                result = null;
+            }
+        };
+        propagator.receiveResponse(NOOP_INPUT_STREAM, PropagationMode.SOAP);
+    }
+
+
+    @Test
+    public void testRestoreThreadContexts() throws Exception {
+        contextMap.put("local", "local context", EnumSet.of(PropagationMode.LOCAL));
+        final AccessControlledMap acm = contextMap.getAccessControlledMap();
+        new TestableThread() {
+
+            @Override
+            public void runTest() throws Exception {
+                propagator.restoreThreadContexts(acm);
+                ContextMap newCM = Utils.getScopeAwareContextMap();
+                assertAll(
+                    () -> assertNotSame(contextMap, newCM),
+                    () -> assertNull(newCM.get("local"), "This one should not propagate since it is LOCAL"),
+                    () -> assertNotNull(newCM.get("default")),
+                    () -> assertNull(newCM.get("soap")),
+                    () -> assertNull(newCM.get("rmi"))
+                );
+            }
+        }.startJoinAndCheckForFailures();
+    }
+
+
+    @Test
+    public void testUseWireAdapter() throws IOException {
+        new Expectations() {
+
+            {
+                adapter.prepareToWriteTo(withInstanceOf(OutputStream.class));
+                times = 1;
+            }
+        };
+        propagator.sendRequest(out, PropagationMode.RMI);
+    }
+
+
+    /**
+     * Create the entry and put it into the simpleMap ({@link SimpleMap})
+     */
+    private Entry createLocationEntry() {
+        final Entry locationEntry = new Entry(new Location(new ViewImpl(Location.KEY)) {
+        }, Location.PROP_MODES, ContextType.VIEW_CAPABLE).init(true, false);
+        simpleMap.put(Location.KEY, locationEntry);
+        return locationEntry;
+    }
 }
diff --git a/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/internal/SimpleMapTest.java b/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/internal/SimpleMapTest.java
index 457e7c6..dde6656 100644
--- a/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/internal/SimpleMapTest.java
+++ b/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/internal/SimpleMapTest.java
@@ -17,220 +17,293 @@
 
 package org.glassfish.contextpropagation.internal;
 
+import java.util.EnumSet;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+
+import org.glassfish.contextpropagation.ContextLifecycle;
+import org.glassfish.contextpropagation.PropagationMode;
+import org.glassfish.contextpropagation.ViewCapable;
+import org.glassfish.contextpropagation.adaptors.BootstrapUtils;
+import org.glassfish.contextpropagation.adaptors.MockContextAccessController;
+import org.glassfish.contextpropagation.adaptors.MockThreadLocalAccessor;
+import org.glassfish.contextpropagation.adaptors.RecordingLoggerAdapter;
+import org.glassfish.contextpropagation.bootstrap.ContextBootstrap;
+import org.glassfish.contextpropagation.bootstrap.LoggerAdapter.Level;
+import org.glassfish.contextpropagation.bootstrap.LoggerAdapter.MessageID;
+import org.glassfish.contextpropagation.internal.Entry.ContextType;
+import org.glassfish.contextpropagation.internal.SimpleMap.Filter;
+import org.glassfish.contextpropagation.wireadapters.glassfish.DefaultWireAdapter;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
 public class SimpleMapTest {
-//  SimpleMap sm;
-//  static RecordingLoggerAdapter logger;
-//
-//  public static class LifeCycleEventRecorder implements ContextLifecycle {
-//    StackTraceElement lastElement;
-//    Object lastArg;
-//
-//    @Override
-//    public void contextChanged(Object replacementContext) {
-//      set(Thread.currentThread().getStackTrace(), replacementContext);
-//    }
-//
-//    @Override
-//    public void contextAdded() {
-//      set(Thread.currentThread().getStackTrace(), null);
-//    }
-//
-//    @Override
-//    public void contextRemoved() {
-//      set(Thread.currentThread().getStackTrace(), null);
-//    }
-//
-//    @Override
-//    public ViewCapable contextToPropagate() {
-//      set(Thread.currentThread().getStackTrace(), null);
-//      return this;
-//    }
-//
-//    void set(StackTraceElement[] trace, Object arg) {
-//      lastElement = trace[1];
-//      lastArg = arg;
-//    }
-//
-//    void verify(String methodName, Object arg) {
-//      assertEquals(methodName, lastElement.getMethodName());
-//      assertEquals(arg, lastArg);
-//      lastElement = null;
-//      lastArg = null;
-//    }
-//
-//  }
-//
-//  private static final LifeCycleEventRecorder LIFE_CYCLE_CONTEXT = new LifeCycleEventRecorder();
-//  static final Entry DUMMY_ENTRY = createEntry(LIFE_CYCLE_CONTEXT, PropagationMode.defaultSet(), ContextType.OPAQUE);
-//
-//  private static Entry createEntry(Object context, EnumSet<PropagationMode> propModes, ContextType ct) {
-//    return new Entry(context, propModes, ct) {
-//      void validate() {}
-//    };
-//  }
-//
-//  @BeforeClass
-//  public static void setupClass() {
-//    logger = new RecordingLoggerAdapter();
-//    BootstrapUtils.reset();
-//    ContextBootstrap.configure(logger,
-//        new DefaultWireAdapter(), new MockThreadLocalAccessor(),
-//        new MockContextAccessController(), "guid");
-//  }
-//
-//  @Before
-//  public void setup() {
-//    sm = new SimpleMap();
-//    sm.put("foo", createEntry("fooString", PropagationMode.defaultSet(), ContextType.STRING));
-//  }
-//
-//  @Test
-//  public void testGetEntry() {
-//    Entry entry = sm.getEntry("foo");
-//    assertEquals("fooString", entry.getValue());
-//    logger.verify(Level.DEBUG, null, MessageID.OPERATION, new Object[] {"getEntry", "foo", entry} );
-//  }
-//
-//  @Test(expected=java.lang.IllegalArgumentException.class)
-//  public void testGetEntryWithNullKey() {
-//    sm.getEntry(null); // Does not log if fails validation
-//  }
-//
-//  @Test
-//  public void testGet() {
-//    assertEquals("fooString", sm.get("foo"));
-//    logger.verify(Level.DEBUG, null, MessageID.OPERATION, new Object[] {"get", "foo", "fooString"} );
-//  }
-//
-//  @Test(expected=java.lang.IllegalArgumentException.class)
-//  public void testGetWithNullKey() {
-//    sm.get(null); // Does not log if validate fails
-//  }
-//
-//  @Test
-//  public void testPutWhereNoBefore() {
-//    Entry e = sm.put("new key", DUMMY_ENTRY);
-//    assertNull(e);
-//    logger.verify(Level.DEBUG, null, MessageID.PUT, new Object[] {"new key", DUMMY_ENTRY.value, null} );
-//    LIFE_CYCLE_CONTEXT.verify("contextAdded", null);
-//  }
-//
-//  @Test
-//  public void testPutReplace() {
-//    LifeCycleEventRecorder oldRecorder = new LifeCycleEventRecorder();
-//    String fooString = sm.put("foo", createEntry(oldRecorder, PropagationMode.defaultSet(), ContextType.OPAQUE));
-//    assertEquals("fooString", fooString);
-//    logger.verify(Level.DEBUG, null, MessageID.PUT, new Object[] {"foo", oldRecorder, "fooString"} );
-//    LifeCycleEventRecorder oldValue = sm.put("foo", DUMMY_ENTRY);
-//    assertEquals(oldRecorder, oldValue);
-//    oldRecorder.verify("contextChanged", LIFE_CYCLE_CONTEXT); // oldRecoder finds out about the new value
-//    LIFE_CYCLE_CONTEXT.verify("contextAdded", null);
-//  }
-//
-//  @Test(expected=java.lang.IllegalArgumentException.class)
-//  public void testPutWithNullKey() {
-//    sm.put(null, DUMMY_ENTRY);
-//  }
-//
-//  @Test(expected=java.lang.IllegalArgumentException.class)
-//  public void testPutWithNullEntry() {
-//    sm.put("dummy key", null);
-//  }
-//
-//  @Test(expected=java.lang.IllegalArgumentException.class)
-//  public void testPutWithNullValue() {
-//    sm.put("dummy key", createEntry(null, PropagationMode.defaultSet(), ContextType.ATOMICINTEGER));
-//  }
-//
-//  @Test(expected=java.lang.IllegalArgumentException.class)
-//  public void testPutWithInvalidEntry() {
-//    sm.put("dummy key", new Entry(null, PropagationMode.defaultSet(), ContextType.ATOMICINTEGER) {
-//      void validate() { throw new IllegalStateException(); }
-//    });
-//  }
-//
-//  @Test
-//  public void testRemove() {
-//    sm.put("removeMe", createEntry(LIFE_CYCLE_CONTEXT, PropagationMode.defaultSet(), ContextType.STRING));
-//    Object removeMe = sm.remove("removeMe");
-//    assertEquals(LIFE_CYCLE_CONTEXT, removeMe);
-//    logger.verify(Level.DEBUG, null, MessageID.OPERATION, new Object[] {"remove", "removeMe", LIFE_CYCLE_CONTEXT} );
-//    LIFE_CYCLE_CONTEXT.verify("contextRemoved", null);
-//  }
-//
-//  @Test
-//  public void testRemoveNoneExistent() {
-//    String removeMe = sm.remove("removeMe");
-//    assertEquals(null, removeMe);
-//  }
-//
-//  @Test
-//  public void testEmptyIterator() {
-//    SimpleMap emptyMap = new SimpleMap();
-//    Iterator<?> iter = emptyMap.iterator(null, null);
-//    assertFalse(iter.hasNext());
-//  }
-//
-//  @Test
-//  public void testIteratorFiltersAll() {
-//    sm.put("dummy", DUMMY_ENTRY);
-//    Iterator<Map.Entry<String, Entry>> iter = sm.iterator(new Filter() {
-//      @Override
-//      public boolean keep(java.util.Map.Entry<String, Entry> mapEntry,
-//          PropagationMode mode) {
-//        return false;
-//      }
-//    }, PropagationMode.JMS_QUEUE);
-//    assertFalse(iter.hasNext());
-//  }
-//
-//  @SuppressWarnings("serial")
-//  @Test
-//  public void testIteratorFilterNone() {
-//    sm.put("dummy", DUMMY_ENTRY);
-//    Iterator<Map.Entry<String, Entry>> iter = sm.iterator(new Filter() {
-//      @Override
-//      public boolean keep(java.util.Map.Entry<String, Entry> mapEntry,
-//          PropagationMode mode) {
-//        return true;
-//      }
-//    }, PropagationMode.JMS_QUEUE);
-//    int count = 0;
-//    HashSet<String> keys = new HashSet<String>();
-//    while (iter.hasNext()) {
-//      keys.add(iter.next().getKey());
-//      count++;
-//    }
-//    assertEquals(2, count);
-//    assertEquals(new HashSet<String>() {{add("foo"); add("dummy");}}, keys);
-//  }
-//
-//  @Test
-//  public void testIteratorRemove() {
-//    sm.put("dummy", DUMMY_ENTRY);
-//    Iterator<Map.Entry<String, Entry>> iter = sm.iterator(new Filter() {
-//      @Override
-//      public boolean keep(java.util.Map.Entry<String, Entry> mapEntry,
-//          PropagationMode mode) {
-//        return true;
-//      }
-//    }, PropagationMode.JMS_QUEUE);
-//    assertEquals(2, sm.map.size());
-//    assertNotNull(iter.next());
-//    iter.remove();
-//    assertEquals(1, sm.map.size());
-//    assertNotNull(iter.next());
-//    iter.remove();
-//    assertEquals(0, sm.map.size());
-//    int exceptionCount = 0;
-//    try {
-//      iter.next();
-//    } catch (NoSuchElementException nsee) {exceptionCount++;}
-//    assertEquals("Expected NoSuchElementException after the last element was retrieved", 1, exceptionCount);
-//    try {
-//      iter.remove();
-//    } catch (IllegalStateException ise) {exceptionCount++;}
-//    assertEquals("Expected IllegalStateException on last remove call", 2, exceptionCount);
-//  }
+
+    private SimpleMap sm;
+    private static RecordingLoggerAdapter logger;
+
+    public static class LifeCycleEventRecorder implements ContextLifecycle {
+
+        StackTraceElement lastElement;
+        Object lastArg;
+
+        @Override
+        public void contextChanged(Object replacementContext) {
+            set(Thread.currentThread().getStackTrace(), replacementContext);
+        }
+
+
+        @Override
+        public void contextAdded() {
+            set(Thread.currentThread().getStackTrace(), null);
+        }
+
+
+        @Override
+        public void contextRemoved() {
+            set(Thread.currentThread().getStackTrace(), null);
+        }
+
+
+        @Override
+        public ViewCapable contextToPropagate() {
+            set(Thread.currentThread().getStackTrace(), null);
+            return this;
+        }
+
+
+        void set(StackTraceElement[] trace, Object arg) {
+            lastElement = trace[1];
+            lastArg = arg;
+        }
+
+
+        void verify(String methodName, Object arg) {
+            assertEquals(methodName, lastElement.getMethodName());
+            assertEquals(arg, lastArg);
+            lastElement = null;
+            lastArg = null;
+        }
+
+    }
+
+    private static final LifeCycleEventRecorder LIFE_CYCLE_CONTEXT = new LifeCycleEventRecorder();
+    static final Entry DUMMY_ENTRY = createEntry(LIFE_CYCLE_CONTEXT, PropagationMode.defaultSet(), ContextType.OPAQUE);
+
+    private static Entry createEntry(Object context, EnumSet<PropagationMode> propModes, ContextType ct) {
+        return new Entry(context, propModes, ct) {
+
+            @Override
+            void validate() {
+            }
+        };
+    }
+
+
+    @BeforeAll
+    public static void setupClass() {
+        logger = new RecordingLoggerAdapter();
+        BootstrapUtils.reset();
+        ContextBootstrap.configure(logger, new DefaultWireAdapter(), new MockThreadLocalAccessor(),
+            new MockContextAccessController(), "guid");
+    }
+
+
+    @BeforeEach
+    public void setup() {
+        sm = new SimpleMap();
+        sm.put("foo", createEntry("fooString", PropagationMode.defaultSet(), ContextType.STRING));
+    }
+
+
+    @Test
+    public void testGetEntry() {
+        Entry entry = sm.getEntry("foo");
+        assertEquals("fooString", entry.getValue());
+        logger.verify(Level.DEBUG, null, MessageID.OPERATION, new Object[] {"getEntry", "foo", entry});
+    }
+
+
+    @Test
+    public void testGetEntryWithNullKey() {
+        assertThrows(IllegalArgumentException.class, () -> sm.getEntry(null));
+    }
+
+
+    @Test
+    public void testGet() {
+        assertEquals("fooString", sm.get("foo"));
+        logger.verify(Level.DEBUG, null, MessageID.OPERATION, new Object[] {"get", "foo", "fooString"});
+    }
+
+
+    @Test
+    public void testGetWithNullKey() {
+        assertThrows(IllegalArgumentException.class, () -> sm.get(null));
+    }
+
+
+    @Test
+    public void testPutWhereNoBefore() {
+        Entry e = sm.put("new key", DUMMY_ENTRY);
+        assertNull(e);
+        logger.verify(Level.DEBUG, null, MessageID.PUT, new Object[] {"new key", DUMMY_ENTRY.value, null});
+        LIFE_CYCLE_CONTEXT.verify("contextAdded", null);
+    }
+
+
+    @Test
+    public void testPutReplace() {
+        LifeCycleEventRecorder oldRecorder = new LifeCycleEventRecorder();
+        String fooString = sm.put("foo", createEntry(oldRecorder, PropagationMode.defaultSet(), ContextType.OPAQUE));
+        assertEquals("fooString", fooString);
+        logger.verify(Level.DEBUG, null, MessageID.PUT, new Object[] {"foo", oldRecorder, "fooString"});
+        LifeCycleEventRecorder oldValue = sm.put("foo", DUMMY_ENTRY);
+        assertEquals(oldRecorder, oldValue);
+        // oldRecoder finds out about the new value
+        oldRecorder.verify("contextChanged", LIFE_CYCLE_CONTEXT);
+        LIFE_CYCLE_CONTEXT.verify("contextAdded", null);
+    }
+
+
+    @Test
+    public void testPutWithNullKey() {
+        assertThrows(IllegalArgumentException.class, () -> sm.put(null, DUMMY_ENTRY));
+    }
+
+
+    @Test
+    public void testPutWithNullEntry() {
+        assertThrows(IllegalArgumentException.class, () -> sm.put("dummy key", null));
+    }
+
+
+    @Test
+    public void testPutWithNullValue() {
+        assertThrows(IllegalArgumentException.class,
+            () -> sm.put("dummy key", createEntry(null, PropagationMode.defaultSet(), ContextType.ATOMICINTEGER)));
+    }
+
+
+    @Test
+    public void testPutWithInvalidEntry() {
+        Entry entry = new Entry(null, PropagationMode.defaultSet(), ContextType.ATOMICINTEGER) {
+
+            @Override
+            void validate() {
+                throw new IllegalStateException();
+            }
+        };
+        assertThrows(IllegalArgumentException.class, () -> sm.put("dummy key", entry));
+    }
+
+
+    @Test
+    public void testRemove() {
+        sm.put("removeMe", createEntry(LIFE_CYCLE_CONTEXT, PropagationMode.defaultSet(), ContextType.STRING));
+        Object removeMe = sm.remove("removeMe");
+        assertEquals(LIFE_CYCLE_CONTEXT, removeMe);
+        logger.verify(Level.DEBUG, null, MessageID.OPERATION, new Object[] {"remove", "removeMe", LIFE_CYCLE_CONTEXT});
+        LIFE_CYCLE_CONTEXT.verify("contextRemoved", null);
+    }
+
+
+    @Test
+    public void testRemoveNoneExistent() {
+        String removeMe = sm.remove("removeMe");
+        assertEquals(null, removeMe);
+    }
+
+
+    @Test
+    public void testEmptyIterator() {
+        SimpleMap emptyMap = new SimpleMap();
+        Iterator<?> iter = emptyMap.iterator(null, null);
+        assertFalse(iter.hasNext());
+    }
+
+
+    @Test
+    public void testIteratorFiltersAll() {
+        sm.put("dummy", DUMMY_ENTRY);
+        Iterator<Map.Entry<String, Entry>> iter = sm.iterator(new Filter() {
+
+            @Override
+            public boolean keep(java.util.Map.Entry<String, Entry> mapEntry, PropagationMode mode) {
+                return false;
+            }
+        }, PropagationMode.JMS_QUEUE);
+        assertFalse(iter.hasNext());
+    }
+
+
+    @SuppressWarnings("serial")
+    @Test
+    public void testIteratorFilterNone() {
+        sm.put("dummy", DUMMY_ENTRY);
+        Iterator<Map.Entry<String, Entry>> iter = sm.iterator(new Filter() {
+
+            @Override
+            public boolean keep(java.util.Map.Entry<String, Entry> mapEntry, PropagationMode mode) {
+                return true;
+            }
+        }, PropagationMode.JMS_QUEUE);
+        int count = 0;
+        HashSet<String> keys = new HashSet<>();
+        while (iter.hasNext()) {
+            keys.add(iter.next().getKey());
+            count++;
+        }
+        assertEquals(2, count);
+        assertEquals(new HashSet<String>() {
+
+            {
+                add("foo");
+                add("dummy");
+            }
+        }, keys);
+    }
+
+
+    @Test
+    public void testIteratorRemove() {
+        sm.put("dummy", DUMMY_ENTRY);
+        Iterator<Map.Entry<String, Entry>> iter = sm.iterator(new Filter() {
+
+            @Override
+            public boolean keep(java.util.Map.Entry<String, Entry> mapEntry, PropagationMode mode) {
+                return true;
+            }
+        }, PropagationMode.JMS_QUEUE);
+        assertEquals(2, sm.map.size());
+        assertNotNull(iter.next());
+        iter.remove();
+        assertEquals(1, sm.map.size());
+        assertNotNull(iter.next());
+        iter.remove();
+        assertEquals(0, sm.map.size());
+        int exceptionCount = 0;
+        try {
+            iter.next();
+        } catch (NoSuchElementException nsee) {
+            exceptionCount++;
+        }
+        assertEquals(1, exceptionCount, "Expected NoSuchElementException after the last element was retrieved");
+        try {
+            iter.remove();
+        } catch (IllegalStateException ise) {
+            exceptionCount++;
+        }
+        assertEquals(2, exceptionCount, "Expected IllegalStateException on last remove call");
+    }
 
 }
diff --git a/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/internal/UtilsTest.java b/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/internal/UtilsTest.java
index bf1fa9f..095c12c 100644
--- a/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/internal/UtilsTest.java
+++ b/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/internal/UtilsTest.java
@@ -17,115 +17,152 @@
 
 package org.glassfish.contextpropagation.internal;
 
-//import mockit.Deencapsulation;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.Map;
 
+import org.glassfish.contextpropagation.ContextViewFactory;
+import org.glassfish.contextpropagation.PropagationMode;
+import org.glassfish.contextpropagation.View;
+import org.glassfish.contextpropagation.ViewCapable;
+import org.glassfish.contextpropagation.adaptors.BootstrapUtils;
+import org.glassfish.contextpropagation.adaptors.RecordingLoggerAdapter;
+import org.glassfish.contextpropagation.bootstrap.ContextBootstrap;
+import org.glassfish.contextpropagation.bootstrap.LoggerAdapter.Level;
+import org.glassfish.contextpropagation.bootstrap.LoggerAdapter.MessageID;
+import org.glassfish.contextpropagation.wireadapters.glassfish.DefaultWireAdapter;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 public class UtilsTest {
-//  @BeforeClass
-//  public static void setupClass() {
-//    BootstrapUtils.bootstrap(new DefaultWireAdapter());
-//  }
-//
-//  @Test
-//  public void testGetScopeAwarePropagator() {
-//    assertNotNull(Utils.getScopeAwarePropagator());
-//  }
-//
-//  @Test
-//  public void testGetScopeAwareContextMap() {
-//    assertNotNull(Utils.getScopeAwarePropagator());
-//  }
-//
-//  @Test
-//  public void testRegisterContextFactoryForPrefixNamed() {
-//    Utils.registerContextFactoryForPrefixNamed("prefix",
-//        new ContextViewFactory() {
-//           @Override
-//          public EnumSet<PropagationMode> getPropagationModes() {
-//            return PropagationMode.defaultSet();
-//          }
-//          @Override
-//          public ViewCapable createInstance(View view) {
-//            return new ViewCapable() {};
-//          }
-//        });
-//    assertNotNull(Utils.getFactory("prefix"));
-//  }
-//
-//  private static final Object CONTEXT_VIEW_FACTORY = new ContextViewFactory() {
-//    @Override
-//    public ViewCapable createInstance(View view) {
-//       return null;
-//    }
-//    @Override
-//    public EnumSet<PropagationMode> getPropagationModes() {
-//      return null;
-//    }
-//  };
-//
-//  private static MessageID msgID = MessageID.WRITING_KEY; // We need a dummy MessageID
-//  @Test(expected=IllegalArgumentException.class)
-//  public void testValidateFactoryRegistrationArgsNullKey() {
-//    Utils.validateFactoryRegistrationArgs(null, msgID, "context class name",
-//        CONTEXT_VIEW_FACTORY, null);
-//  }
-//
-//  @Test(expected=IllegalArgumentException.class)
-//  public void testValidateFactoryRegistrationArgsNullContextClassName() {
-//    Utils.validateFactoryRegistrationArgs("key", msgID, null,
-//        CONTEXT_VIEW_FACTORY, null);
-//  }
-//
-//  @Test(expected=IllegalArgumentException.class)
-//  public void testValidateFactoryRegistrationArgsNullFactory() {
-//    Utils.validateFactoryRegistrationArgs("key", msgID, "context class name",
-//        null, null);
-//  }
-//
-//  @Test
-//  public void testValidateFactoryRegistration() {
-//    Map<String, ?> map = Collections.emptyMap();
-//    Utils.validateFactoryRegistrationArgs("key", msgID, "context class name",
-//        CONTEXT_VIEW_FACTORY, map);
-//  }
-//  @Test(expected=IllegalArgumentException.class)
-//  public void testValidateFactoryRegistrationNullKey() {
-//    Map<String, ?> map = Collections.emptyMap();
-//    Utils.validateFactoryRegistrationArgs(null, msgID, "context class name",
-//        CONTEXT_VIEW_FACTORY, map);
-//  }
-//  @Test(expected=IllegalArgumentException.class)
-//  public void testValidateFactoryRegistrationNullClassName() {
-//    Map<String, ?> map = Collections.emptyMap();
-//    Utils.validateFactoryRegistrationArgs("key", msgID, null,
-//        CONTEXT_VIEW_FACTORY, map);
-//  }
-//  @Test(expected=IllegalArgumentException.class)
-//  public void testValidateFactoryRegistrationNullFactory() {
-//    Map<String, ?> map = Collections.emptyMap();
-//    Utils.validateFactoryRegistrationArgs("key", msgID, "context class name",
-//        null, map);
-//  }
-//  @Test(expected=IllegalArgumentException.class)
-//  public void testValidateFactoryRegistrationNullMessageID() {
-//    Map<String, ?> map = Collections.emptyMap();
-//    Utils.validateFactoryRegistrationArgs("key", null, "context class name",
-//        CONTEXT_VIEW_FACTORY, map);
-//  }
-//  @Test
-//  public void testValidateFactoryRegistrationAlreadyRegistered() {
-//    RecordingLoggerAdapter logger = new RecordingLoggerAdapter();
-//    Deencapsulation.setField(ContextBootstrap.class, "loggerAdapter", logger);
-//    Map<String, Object> map = new HashMap<String, Object>();
-//    Utils.validateFactoryRegistrationArgs("key", msgID, "context class name",
-//        CONTEXT_VIEW_FACTORY, map);
-//    logger.verify(null, null, null, (Object[]) null);
-//    map.put("context class name", "something");
-//    Utils.validateFactoryRegistrationArgs("key", msgID, "context class name",
-//        CONTEXT_VIEW_FACTORY, map);
-//    logger.verify(Level.WARN, null, msgID, "context class name",
-//        "something", CONTEXT_VIEW_FACTORY);
-//  }
+
+    @BeforeAll
+    public static void setupClass() {
+        BootstrapUtils.bootstrap(new DefaultWireAdapter());
+    }
+
+
+    @Test
+    public void testGetScopeAwarePropagator() {
+        assertNotNull(Utils.getScopeAwarePropagator());
+    }
+
+
+    @Test
+    public void testGetScopeAwareContextMap() {
+        assertNotNull(Utils.getScopeAwarePropagator());
+    }
+
+
+    @Test
+    public void testRegisterContextFactoryForPrefixNamed() {
+        Utils.registerContextFactoryForPrefixNamed("prefix", new ContextViewFactory() {
+
+            @Override
+            public EnumSet<PropagationMode> getPropagationModes() {
+                return PropagationMode.defaultSet();
+            }
+
+
+            @Override
+            public ViewCapable createInstance(View view) {
+                return new ViewCapable() {
+                };
+            }
+        });
+        assertNotNull(Utils.getFactory("prefix"));
+    }
+
+    private static final Object CONTEXT_VIEW_FACTORY = new ContextViewFactory() {
+
+        @Override
+        public ViewCapable createInstance(View view) {
+            return null;
+        }
+
+
+        @Override
+        public EnumSet<PropagationMode> getPropagationModes() {
+            return null;
+        }
+    };
+
+    private static MessageID msgID = MessageID.WRITING_KEY; // We need a dummy MessageID
+
+    @Test
+    public void testValidateFactoryRegistrationArgsNullKey() {
+        assertThrows(IllegalArgumentException.class,
+            () -> Utils.validateFactoryRegistrationArgs(null, msgID, "context class name", CONTEXT_VIEW_FACTORY, null));
+    }
+
+
+    @Test
+    public void testValidateFactoryRegistrationArgsNullContextClassName() {
+        assertThrows(IllegalArgumentException.class,
+            () -> Utils.validateFactoryRegistrationArgs("key", msgID, null, CONTEXT_VIEW_FACTORY, null));
+    }
+
+
+    @Test
+    public void testValidateFactoryRegistrationArgsNullFactory() {
+        assertThrows(IllegalArgumentException.class,
+            () -> Utils.validateFactoryRegistrationArgs("key", msgID, "context class name", null, null));
+    }
+
+
+    @Test
+    public void testValidateFactoryRegistration() {
+        Map<String, ?> map = Collections.emptyMap();
+        Utils.validateFactoryRegistrationArgs("key", msgID, "context class name", CONTEXT_VIEW_FACTORY, map);
+    }
+
+
+    @Test
+    public void testValidateFactoryRegistrationNullKey() {
+        Map<String, ?> map = Collections.emptyMap();
+        assertThrows(IllegalArgumentException.class,
+            () -> Utils.validateFactoryRegistrationArgs(null, msgID, "context class name", CONTEXT_VIEW_FACTORY, map));
+    }
+
+
+    @Test
+    public void testValidateFactoryRegistrationNullClassName() {
+        Map<String, ?> map = Collections.emptyMap();
+        assertThrows(IllegalArgumentException.class,
+            () -> Utils.validateFactoryRegistrationArgs("key", msgID, null, CONTEXT_VIEW_FACTORY, map));
+    }
+
+
+    @Test
+    public void testValidateFactoryRegistrationNullFactory() {
+        Map<String, ?> map = Collections.emptyMap();
+        assertThrows(IllegalArgumentException.class,
+            () -> Utils.validateFactoryRegistrationArgs("key", msgID, "context class name", null, map));
+    }
+
+
+    @Test
+    public void testValidateFactoryRegistrationNullMessageID() {
+        Map<String, ?> map = Collections.emptyMap();
+        assertThrows(IllegalArgumentException.class,
+            () -> Utils.validateFactoryRegistrationArgs("key", null, "context class name", CONTEXT_VIEW_FACTORY, map));
+    }
+
+
+    @Test
+    public void testValidateFactoryRegistrationAlreadyRegistered() {
+        RecordingLoggerAdapter logger = new RecordingLoggerAdapter();
+        BootstrapUtils.setStaticField(ContextBootstrap.class, "loggerAdapter", logger);
+        Map<String, Object> map = new HashMap<>();
+        Utils.validateFactoryRegistrationArgs("key", msgID, "context class name", CONTEXT_VIEW_FACTORY, map);
+        logger.verify(null, null, null, (Object[]) null);
+        map.put("context class name", "something");
+        Utils.validateFactoryRegistrationArgs("key", msgID, "context class name", CONTEXT_VIEW_FACTORY, map);
+        logger.verify(Level.WARN, null, msgID, "context class name", "something", CONTEXT_VIEW_FACTORY);
+    }
 
 }
diff --git a/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/internal/ViewImplTest.java b/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/internal/ViewImplTest.java
index 6a18cd8..7ec7604 100644
--- a/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/internal/ViewImplTest.java
+++ b/nucleus/core/context-propagation/src/test/java/org/glassfish/contextpropagation/internal/ViewImplTest.java
@@ -17,74 +17,95 @@
 
 package org.glassfish.contextpropagation.internal;
 
-//import mockit.Deencapsulation;
+import org.glassfish.contextpropagation.PropagationMode;
+import org.glassfish.contextpropagation.adaptors.BootstrapUtils;
+import org.glassfish.contextpropagation.internal.Entry.ContextType;
+import org.glassfish.contextpropagation.wireadapters.glassfish.DefaultWireAdapter;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 
-
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 public class ViewImplTest {
-//  static ViewImpl view;
-//  static SimpleMap sm;
-//
-//  @BeforeClass
-//  public static void setupClass() {
-//    BootstrapUtils.bootstrap(new DefaultWireAdapter());
-//    view = new ViewImpl("prefix");
-//    sm = new SimpleMap();
-//    Deencapsulation.setField(view, "sMap", sm);
-//    sm.put("prefix.removeMe", new Entry("removeMe", PropagationMode.defaultSet(), ContextType.STRING).init(true, true));
-//    sm.put("prefix.getMe", new Entry("getMe", PropagationMode.defaultSet(), ContextType.STRING).init(true, true));
-//    sm.put("prefix.string", new Entry("string", PropagationMode.defaultSet(), ContextType.STRING).init(true, true));
-//    sm.put("prefix.asciiString", new Entry("asciistring", PropagationMode.defaultSet(), ContextType.ASCII_STRING).init(true, true));
-//    sm.put("prefix.long", new Entry(1L, PropagationMode.defaultSet(), ContextType.LONG).init(true, true));
-//    sm.put("prefix.boolean", new Entry(true, PropagationMode.defaultSet(), ContextType.BOOLEAN).init(true, true));
-//    sm.put("prefix.char", new Entry('c', PropagationMode.defaultSet(), ContextType.CHAR).init(true, true));
-//    sm.put("prefix.serializable", new Entry("serializable", PropagationMode.defaultSet(), ContextType.SERIALIZABLE).init(true, true));
-//  }
-//
-//  @Test
-//  public void testGet() {
-//    assertEquals("getMe", view.get("getMe"));
-//  }
-//
-//  @Test
-//  public void testPutStringStringEnumSetOfPropagationModeBoolean() {
-//    checkPut("string", "string", "new_string", ContextType.STRING);
-//  }
-//
-//  <T> void checkPut(String key, Object origValue, Object newValue, ContextType contextType) {
-//    assertEquals(origValue, Deencapsulation.invoke(view, "put", key, newValue, PropagationMode.defaultSet()));
-//    assertEquals(newValue, sm.get("prefix." + key));
-//    assertEquals(ContextType.STRING, sm.getEntry("prefix.string").getContextType());
-//  }
-//
-//  @Test
-//  public void testPutAscii() {
-//    checkPut("asciiString", "asciistring", "new_asciistring", ContextType.ASCII_STRING);
-//  }
-//
-//  @Test
-//  public void testPutStringUEnumSetOfPropagationModeBoolean() {
-//    checkPut("long", 1L, 2L, ContextType.LONG);
-//  }
-//
-//  @Test
-//  public void testPutStringBooleanEnumSetOfPropagationModeBoolean() {
-//    checkPut("boolean", true, false, ContextType.BOOLEAN);
-//  }
-//
-//  @Test
-//  public void testPutStringCharacterEnumSetOfPropagationModeBoolean() {
-//    checkPut("char", 'c', 'd', ContextType.CHAR);
-//  }
-//
-//  @Test
-//  public void testPutSerializable() {
-//    checkPut("serializable", (Serializable) "serializable", (Serializable) "new_serializable", ContextType.SERIALIZABLE);
-//  }
-//
-//  @Test
-//  public void testRemove() {
-//    assertEquals("removeMe", view.remove("removeMe"));
-//  }
 
+    static ViewImpl view;
+    static SimpleMap sm;
+
+    @BeforeAll
+    public static void setupClass() {
+        BootstrapUtils.bootstrap(new DefaultWireAdapter());
+        view = new ViewImpl("prefix");
+        sm = new SimpleMap();
+        BootstrapUtils.setField(view, "sMap", sm);
+        sm.put("prefix.removeMe",
+            new Entry("removeMe", PropagationMode.defaultSet(), ContextType.STRING).init(true, true));
+        sm.put("prefix.getMe", new Entry("getMe", PropagationMode.defaultSet(), ContextType.STRING).init(true, true));
+        sm.put("prefix.string", new Entry("string", PropagationMode.defaultSet(), ContextType.STRING).init(true, true));
+        sm.put("prefix.asciiString",
+            new Entry("asciistring", PropagationMode.defaultSet(), ContextType.ASCII_STRING).init(true, true));
+        sm.put("prefix.long", new Entry(1L, PropagationMode.defaultSet(), ContextType.LONG).init(true, true));
+        sm.put("prefix.boolean", new Entry(true, PropagationMode.defaultSet(), ContextType.BOOLEAN).init(true, true));
+        sm.put("prefix.char", new Entry('c', PropagationMode.defaultSet(), ContextType.CHAR).init(true, true));
+        sm.put("prefix.serializable",
+            new Entry("serializable", PropagationMode.defaultSet(), ContextType.SERIALIZABLE).init(true, true));
+    }
+
+
+    @Test
+    public void testGet() {
+        assertEquals("getMe", view.get("getMe"));
+    }
+
+
+    @Test
+    public void testPutString() {
+        String key = "string";
+        String oldValue = "string";
+        String newValue = "new_string";
+        String returnedValue = view.put(key, newValue, PropagationMode.defaultSet());
+        checkPut(key, oldValue, newValue, returnedValue);
+    }
+
+
+    @Test
+    public void testPutLong() {
+        String key = "long";
+        long oldValue = 1L;
+        long newValue = 2L;
+        Long returnedValue = view.put(key, newValue, PropagationMode.defaultSet());
+        checkPut(key, oldValue, newValue, returnedValue);
+    }
+
+
+    @Test
+    public void testPutBoolean() {
+        String key = "boolean";
+        boolean oldValue = true;
+        boolean newValue = false;
+        Boolean returnedValue = view.put(key, newValue, PropagationMode.defaultSet());
+        checkPut(key, oldValue, newValue, returnedValue);
+    }
+
+
+    @Test
+    public void testPutChar() {
+        String key = "char";
+        char oldValue = 'c';
+        char newValue = 'd';
+        Character returnedValue = view.put(key, newValue, PropagationMode.defaultSet());
+        checkPut(key, oldValue, newValue, returnedValue);
+    }
+
+
+    @Test
+    public void testRemove() {
+        assertEquals("removeMe", view.remove("removeMe"));
+    }
+
+
+    private void checkPut(String key, Object origValue, Object newValue, Object returnedValue) {
+        assertEquals(origValue, returnedValue);
+        assertEquals(newValue, sm.get("prefix." + key));
+        assertEquals(ContextType.STRING, sm.getEntry("prefix.string").getContextType());
+    }
 }