diff --git a/madura-workflow/src/test/java/nz/co/senanque/workflow/WorkflowWithRules2Test.java b/madura-workflow/src/test/java/nz/co/senanque/workflow/WorkflowWithRules2Test.java
index <HASH>..<HASH> 100644
--- a/madura-workflow/src/test/java/nz/co/senanque/workflow/WorkflowWithRules2Test.java
+++ b/madura-workflow/src/test/java/nz/co/senanque/workflow/WorkflowWithRules2Test.java
@@ -83,7 +83,9 @@ public class WorkflowWithRules2Test {
     }
 	@AfterClass
 	public static void destroy() {
-		s_applicationContext.close();
+		if (s_applicationContext != null) {
+			s_applicationContext.close();
+		}
 		s_endpoint.stop();
 	}
     /**
fixed problem with closing a null db (which was never opened)