diff --git a/kubernetes-server-mock/src/main/java/io/fabric8/kubernetes/client/server/mock/KubernetesMockServerExtension.java b/kubernetes-server-mock/src/main/java/io/fabric8/kubernetes/client/server/mock/KubernetesMockServerExtension.java
index <HASH>..<HASH> 100644
--- a/kubernetes-server-mock/src/main/java/io/fabric8/kubernetes/client/server/mock/KubernetesMockServerExtension.java
+++ b/kubernetes-server-mock/src/main/java/io/fabric8/kubernetes/client/server/mock/KubernetesMockServerExtension.java
@@ -74,8 +74,10 @@ public class KubernetesMockServerExtension implements AfterEachCallback, AfterAl
           f.setAccessible(true);
           if (isStatic) {
             f.set(null, client);
-          } else if (context.getTestInstance().isPresent()) {
-            f.set(context.getTestInstance().get(), client);
+          } else {
+            Optional<Object> optTestInstance = context.getTestInstance();
+            if (optTestInstance.isPresent())
+              f.set(optTestInstance.get(), client);
           }
         }
       }
#<I> Single change after revert