You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2019/07/30 14:54:24 UTC

[tinkerpop] 01/03: Moved iterator leak assertion after "test end" event

This is an automated email from the ASF dual-hosted git repository.

spmallette pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git

commit 31deb7e33f2a2912449e8e633f72b8d6036d1f69
Author: Stephen Mallette <sp...@genoprime.com>
AuthorDate: Tue Jul 30 10:36:07 2019 -0400

    Moved iterator leak assertion after "test end" event
    
    This change should give providers a chance to do any additional cleanup prior to testing for iterator leaks. CTR
---
 .../java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java     | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java
index 95cfbb4..9bfbc7b 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java
@@ -31,7 +31,6 @@ import org.apache.tinkerpop.gremlin.structure.VertexProperty;
 import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
 import org.apache.tinkerpop.gremlin.util.iterator.StoreIteratorCounter;
 import org.junit.After;
-import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.rules.TestName;
@@ -137,13 +136,13 @@ public abstract class AbstractGremlinTest {
     @After
     public void tearDown() throws Exception {
         if (null != graphProvider) {
+            graphProvider.getTestListener().ifPresent(l -> l.onTestEnd(this.getClass(), name.getMethodName()));
+
             if (shouldTestIteratorLeak) {
-                long openItrCount = StoreIteratorCounter.INSTANCE.getOpenIteratorCount();
+                final long openItrCount = StoreIteratorCounter.INSTANCE.getOpenIteratorCount();
                 assertEquals("Iterator leak detected. Open iterator count=" + openItrCount, 0, openItrCount);
             }
 
-            graphProvider.getTestListener().ifPresent(l -> l.onTestEnd(this.getClass(), name.getMethodName()));
-
             // GraphProvider that has implemented the clear method must check null for graph and config.
             graphProvider.clear(graph, config);