You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2016/02/23 19:07:52 UTC

[1/5] incubator-geode git commit: Initial commit with refactored rules

Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-953 [created] 7aba9ae02


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestWatcherTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestWatcherTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestWatcherTest.java
new file mode 100755
index 0000000..5fb2e56
--- /dev/null
+++ b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestWatcherTest.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.rules.serializable;
+
+import static org.assertj.core.api.Assertions.*;
+
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+import org.apache.commons.lang.SerializationUtils;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TestWatcher;
+
+import java.io.Serializable;
+import java.lang.reflect.Field;
+
+/**
+ * Unit tests for {@link SerializableTestWatcher}.
+ */
+@Category(UnitTest.class)
+public class SerializableTestWatcherTest {
+
+  @Test
+  public void hasZeroFields() throws Exception {
+    Field[] fields = TestWatcher.class.getDeclaredFields();
+    for (Field field : fields) {
+      //System.out.println("Field: " + field);
+    }
+    assertThat(fields.length).isEqualTo(0);
+  }
+
+  @Test
+  public void isSerializable() throws Exception {
+    assertThat(SerializableTestWatcher.class).isInstanceOf(Serializable.class);
+  }
+
+  @Test
+  public void canBeSerialized() throws Exception {
+    FakeSerializableTestWatcher instance = new FakeSerializableTestWatcher().value(1);
+
+    FakeSerializableTestWatcher cloned = (FakeSerializableTestWatcher) SerializationUtils.clone(instance);
+
+    assertThat(instance.value()).isEqualTo(1);
+    assertThat(cloned.value()).isEqualTo(1);
+
+    instance.value(2);
+
+    assertThat(instance.value()).isEqualTo(2);
+    assertThat(cloned.value()).isEqualTo(1);
+  }
+
+  /**
+   * Fake SerializableTestWatcher with a simple int field.
+   */
+  private static class FakeSerializableTestWatcher extends SerializableTestWatcher {
+
+    private int value = 0;
+
+    private FakeSerializableTestWatcher value(final int value) {
+      this.value = value;
+      return this;
+    }
+
+    private int value() {
+      return this.value;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTimeoutTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTimeoutTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTimeoutTest.java
new file mode 100755
index 0000000..92a4cd2
--- /dev/null
+++ b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTimeoutTest.java
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.rules.serializable;
+
+import static com.gemstone.gemfire.test.junit.rules.serializable.FieldSerializationUtils.*;
+import static com.gemstone.gemfire.test.junit.rules.serializable.FieldsOfTimeout.*;
+import static org.assertj.core.api.Assertions.*;
+
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+import org.apache.commons.lang.SerializationUtils;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.Timeout;
+
+import java.io.Serializable;
+import java.lang.reflect.Field;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Unit tests for {@link SerializableTimeout}.
+ */
+@Category(UnitTest.class)
+public class SerializableTimeoutTest {
+
+  @Test
+  public void hasThreeFields() throws Exception {
+    Field[] fields = Timeout.class.getDeclaredFields();
+    for (Field field : fields) {
+      //System.out.println("Field: " + field);
+    }
+    assertThat(fields.length).isEqualTo(3);
+  }
+
+  @Test
+  public void fieldTimeoutShouldExist() throws Exception {
+    Field field = Timeout.class.getDeclaredField(FIELD_TIMEOUT);
+    assertThat(field.getType()).isEqualTo(Long.TYPE);
+  }
+
+  @Test
+  public void fieldTimeUnitShouldExist() throws Exception {
+    Field field = Timeout.class.getDeclaredField(FIELD_TIME_UNIT);
+    assertThat(field.getType()).isEqualTo(TimeUnit.class);
+  }
+
+  @Test
+  public void fieldLookForStuckThreadShouldExist() throws Exception {
+    Field field = Timeout.class.getDeclaredField(FIELD_LOOK_FOR_STUCK_THREAD);
+    assertThat(field.getType()).isEqualTo(Boolean.TYPE);
+  }
+
+  @Test
+  public void fieldsCanBeRead() throws Exception {
+    long timeout = 1000;
+    TimeUnit timeUnit = TimeUnit.MILLISECONDS;
+    boolean lookingForStuckThread = false;
+
+    SerializableTimeout instance = SerializableTimeout.builder()
+        .withTimeout(timeout, timeUnit)
+        .withLookingForStuckThread(lookingForStuckThread)
+        .build();
+
+    assertThat(readField(Timeout.class, instance, FIELD_TIMEOUT)).isEqualTo(timeout);
+    assertThat(readField(Timeout.class, instance, FIELD_TIME_UNIT)).isEqualTo(timeUnit);
+    assertThat(readField(Timeout.class, instance, FIELD_LOOK_FOR_STUCK_THREAD)).isEqualTo(lookingForStuckThread);
+  }
+
+  @Test
+  public void isSerializable() throws Exception {
+    assertThat(SerializableTimeout.class).isInstanceOf(Serializable.class);
+  }
+
+  @Test
+  public void canBeSerialized() throws Exception {
+    long timeout = 2;
+    TimeUnit timeUnit = TimeUnit.SECONDS;
+    boolean lookingForStuckThread = true;
+
+    SerializableTimeout instance = SerializableTimeout.builder()
+        .withTimeout(timeout, timeUnit)
+        .withLookingForStuckThread(lookingForStuckThread)
+        .build();
+
+    SerializableTimeout cloned = (SerializableTimeout) SerializationUtils.clone(instance);
+
+    assertThat(readField(Timeout.class, instance, FIELD_TIMEOUT)).isEqualTo(timeout);
+    assertThat(readField(Timeout.class, instance, FIELD_TIME_UNIT)).isEqualTo(timeUnit);
+    assertThat(readField(Timeout.class, instance, FIELD_LOOK_FOR_STUCK_THREAD)).isEqualTo(lookingForStuckThread);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/ExpectedTimeoutRuleTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/ExpectedTimeoutRuleTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/ExpectedTimeoutRuleTest.java
deleted file mode 100755
index b67d1eb..0000000
--- a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/ExpectedTimeoutRuleTest.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.test.junit.rules.tests;
-
-import static com.gemstone.gemfire.test.junit.rules.tests.TestRunner.*;
-import static org.assertj.core.api.Assertions.*;
-
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.runner.Result;
-import org.junit.runner.notification.Failure;
-
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-import com.gemstone.gemfire.test.junit.rules.ExpectedTimeoutRule;
-
-/**
- * Unit tests for ExpectedTimeout JUnit Rule.
- * 
- * @author Kirk Lund
- * @since 8.2
- */
-@Category(UnitTest.class)
-public class ExpectedTimeoutRuleTest {
-
-  @Test
-  public void passesUnused() {
-    Result result = runTest(PassingTestShouldPassWhenUnused.class);
-    
-    assertThat(result.wasSuccessful()).isTrue();
-  }
-  
-  @Test
-  public void failsWithoutExpectedException() {
-    Result result = runTest(FailsWithoutExpectedException.class);
-    
-    assertThat(result.wasSuccessful()).isFalse();
-    
-    List<Failure> failures = result.getFailures();
-    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
-    
-    Failure failure = failures.get(0);
-    assertThat(failure.getException()).isExactlyInstanceOf(AssertionError.class).hasMessage("Expected test to throw an instance of " + TimeoutException.class.getName());
-  }
-  
-  @Test
-  public void failsWithoutExpectedTimeoutException() {
-    Result result = runTest(FailsWithoutExpectedTimeoutException.class);
-    
-    assertThat(result.wasSuccessful()).isFalse();
-    
-    List<Failure> failures = result.getFailures();
-    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
-    
-    Failure failure = failures.get(0);
-    assertThat(failure.getException()).isExactlyInstanceOf(AssertionError.class).hasMessage("Expected test to throw (an instance of " + TimeoutException.class.getName() + " and exception with message a string containing \"" + FailsWithoutExpectedTimeoutException.message + "\")");
-  }
-  
-  @Test
-  public void failsWithExpectedTimeoutButWrongError() {
-    Result result = runTest(FailsWithExpectedTimeoutButWrongError.class);
-    
-    assertThat(result.wasSuccessful()).isFalse();
-    
-    List<Failure> failures = result.getFailures();
-    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
-    
-    Failure failure = failures.get(0);
-    String expectedMessage = 
-        "\n" + 
-        "Expected: (an instance of java.util.concurrent.TimeoutException and exception with message a string containing \"this is a message for FailsWithExpectedTimeoutButWrongError\")" +
-        "\n" + 
-        "     " +
-        "but: an instance of java.util.concurrent.TimeoutException <java.lang.NullPointerException> is a java.lang.NullPointerException";
-    assertThat(failure.getException()).isExactlyInstanceOf(AssertionError.class).hasMessageContaining(expectedMessage);
-  }
-  
-  @Test
-  public void passesWithExpectedTimeoutAndTimeoutException() {
-    Result result = runTest(PassesWithExpectedTimeoutAndTimeoutException.class);
-    
-    assertThat(result.wasSuccessful()).isTrue();
-  }
-  
-  @Test
-  public void failsWhenTimeoutIsEarly() {
-    Result result = runTest(FailsWhenTimeoutIsEarly.class);
-   
-    assertThat(result.wasSuccessful()).isFalse();
-    
-    List<Failure> failures = result.getFailures();
-    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
-    
-    Failure failure = failures.get(0);
-    assertThat(failure.getException()).isExactlyInstanceOf(AssertionError.class).hasMessage("Expected test to throw (an instance of " + TimeoutException.class.getName() + " and exception with message a string containing \"" + FailsWhenTimeoutIsEarly.message + "\")");
-  }
-  
-  @Test
-  public void failsWhenTimeoutIsLate() {
-    Result result = runTest(FailsWhenTimeoutIsLate.class);
-    
-    assertThat(result.wasSuccessful()).isFalse();
-    
-    List<Failure> failures = result.getFailures();
-    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
-    
-    Failure failure = failures.get(0);
-    assertThat(failure.getException()).isExactlyInstanceOf(AssertionError.class).hasMessage("Expected test to throw (an instance of " + TimeoutException.class.getName() + " and exception with message a string containing \"" + FailsWhenTimeoutIsLate.message + "\")");
-  }
-  
-  public static class AbstractExpectedTimeoutRuleTest {
-    @Rule
-    public ExpectedTimeoutRule timeout = ExpectedTimeoutRule.none();
-  }
-  
-  public static class PassingTestShouldPassWhenUnused extends AbstractExpectedTimeoutRuleTest {
-    @Test
-    public void passesUnused() throws Exception {
-    }
-  }
-  
-  public static class FailsWithoutExpectedException extends AbstractExpectedTimeoutRuleTest {
-    @Test
-    public void failsWithoutExpectedException() throws Exception {
-      timeout.expect(TimeoutException.class);
-    }
-  }
-  
-  public static class FailsWithoutExpectedTimeoutException extends AbstractExpectedTimeoutRuleTest {
-    public static final String message = "this is a message for FailsWithoutExpectedTimeoutException";
-    @Test
-    public void failsWithoutExpectedTimeoutAndTimeoutException() throws Exception {
-      timeout.expect(TimeoutException.class);
-      timeout.expectMessage(message);
-      timeout.expectMinimumDuration(10);
-      timeout.expectMaximumDuration(1000);
-      timeout.expectTimeUnit(TimeUnit.MILLISECONDS);
-      Thread.sleep(100);
-    }
-  }
-  
-  public static class FailsWithExpectedTimeoutButWrongError extends AbstractExpectedTimeoutRuleTest {
-    public static final String message = "this is a message for FailsWithExpectedTimeoutButWrongError";
-    @Test
-    public void failsWithExpectedTimeoutButWrongError() throws Exception {
-      timeout.expect(TimeoutException.class);
-      timeout.expectMessage(message);
-      timeout.expectMinimumDuration(10);
-      timeout.expectMaximumDuration(1000);
-      timeout.expectTimeUnit(TimeUnit.MILLISECONDS);
-      Thread.sleep(100);
-      throw new NullPointerException();
-    }
-  }
-
-  public static class PassesWithExpectedTimeoutAndTimeoutException extends AbstractExpectedTimeoutRuleTest {
-    public static final String message = "this is a message for PassesWithExpectedTimeoutAndTimeoutException";
-    public static final Class<TimeoutException> exceptionClass = TimeoutException.class;
-    @Test
-    public void passesWithExpectedTimeoutAndTimeoutException() throws Exception {
-      timeout.expect(exceptionClass);
-      timeout.expectMessage(message);
-      timeout.expectMinimumDuration(10);
-      timeout.expectMaximumDuration(1000);
-      timeout.expectTimeUnit(TimeUnit.MILLISECONDS);
-      Thread.sleep(100);
-      throw new TimeoutException(message);
-    }
-  }
-
-  public static class FailsWhenTimeoutIsEarly extends AbstractExpectedTimeoutRuleTest {
-    public static final String message = "this is a message for FailsWhenTimeoutIsEarly";
-    @Test
-    public void failsWhenTimeoutIsEarly() throws Exception {
-      timeout.expect(TimeoutException.class);
-      timeout.expectMessage(message);
-      timeout.expectMinimumDuration(1000);
-      timeout.expectMaximumDuration(2000);
-      timeout.expectTimeUnit(TimeUnit.MILLISECONDS);
-      Thread.sleep(10);
-    }
-  }
-
-  public static class FailsWhenTimeoutIsLate extends AbstractExpectedTimeoutRuleTest {
-    public static final String message = "this is a message for FailsWhenTimeoutIsLate";
-    @Test
-    public void failsWhenTimeoutIsLate() throws Exception {
-      timeout.expect(TimeoutException.class);
-      timeout.expectMessage(message);
-      timeout.expectMinimumDuration(10);
-      timeout.expectMaximumDuration(20);
-      timeout.expectTimeUnit(TimeUnit.MILLISECONDS);
-      Thread.sleep(100);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/IgnoreUntilRuleTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/IgnoreUntilRuleTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/IgnoreUntilRuleTest.java
deleted file mode 100755
index a984d1d..0000000
--- a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/IgnoreUntilRuleTest.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.test.junit.rules.tests;
-
-import static com.gemstone.gemfire.test.junit.rules.tests.TestRunner.*;
-import static org.assertj.core.api.Assertions.*;
-
-import java.util.List;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.runner.Result;
-import org.junit.runner.notification.Failure;
-
-import com.gemstone.gemfire.test.junit.IgnoreUntil;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-import com.gemstone.gemfire.test.junit.rules.IgnoreUntilRule;
-
-/**
- * Unit tests for IgnoreUntil JUnit Rule
- * 
- * @author Kirk Lund
- */
-@Category(UnitTest.class)
-public class IgnoreUntilRuleTest {
-
-  private static final String ASSERTION_ERROR_MESSAGE = "failing test";
-  
-  @Test
-  public void shouldIgnoreWhenUntilIsInFuture() {
-    Result result = runTest(ShouldIgnoreWhenUntilIsInFuture.class);
-    
-    assertThat(result.wasSuccessful()).isTrue();
-    assertThat(ShouldIgnoreWhenUntilIsInFuture.count).isEqualTo(0);
-  }
-  
-  @Test
-  public void shouldExecuteWhenUntilIsInPast() {
-    Result result = runTest(ShouldExecuteWhenUntilIsInPast.class);
-    
-    assertThat(result.wasSuccessful()).isFalse();
-    
-    List<Failure> failures = result.getFailures();
-    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
-
-    Failure failure = failures.get(0);
-    assertThat(failure.getException()).isExactlyInstanceOf(AssertionError.class).hasMessage(ASSERTION_ERROR_MESSAGE);
-    assertThat(ShouldExecuteWhenUntilIsInPast.count).isEqualTo(1);
-  }
-  
-  @Test
-  public void shouldExecuteWhenUntilIsDefault() {
-    Result result = runTest(ShouldExecuteWhenUntilIsDefault.class);
-    
-    assertThat(result.wasSuccessful()).isFalse();
-    
-    List<Failure> failures = result.getFailures();
-    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
-
-    Failure failure = failures.get(0);
-    assertThat(failure.getException()).isExactlyInstanceOf(AssertionError.class).hasMessage(ASSERTION_ERROR_MESSAGE);
-    assertThat(ShouldExecuteWhenUntilIsDefault.count).isEqualTo(1);
-  }
-  
-  public static class ShouldIgnoreWhenUntilIsInFuture {
-    private static int count;
-    
-    @Rule
-    public final IgnoreUntilRule ignoreUntilRule = new IgnoreUntilRule();
-    
-    @Test
-    @IgnoreUntil(value = "description", until = "3000-01-01")
-    public void doTest() throws Exception {
-      count++;
-      fail(ASSERTION_ERROR_MESSAGE);
-    }
-  }
-
-  public static class ShouldExecuteWhenUntilIsInPast {
-    private static int count;
-    
-    @Rule
-    public final IgnoreUntilRule ignoreUntilRule = new IgnoreUntilRule();
-    
-    @Test
-    @IgnoreUntil(value = "description", until = "1980-01-01")
-    public void doTest() throws Exception {
-      count++;
-      fail(ASSERTION_ERROR_MESSAGE);
-    }
-  }
-
-  public static class ShouldExecuteWhenUntilIsDefault {
-    private static int count;
-    
-    @Rule
-    public final IgnoreUntilRule ignoreUntilRule = new IgnoreUntilRule();
-    
-    @Test
-    @IgnoreUntil(value = "description")
-    public void doTest() throws Exception {
-      count++;
-      fail(ASSERTION_ERROR_MESSAGE);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/JUnitRuleTestSuite.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/JUnitRuleTestSuite.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/JUnitRuleTestSuite.java
deleted file mode 100755
index 4c9e315..0000000
--- a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/JUnitRuleTestSuite.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.test.junit.rules.tests;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
-  ExpectedTimeoutRuleTest.class,
-  IgnoreUntilRuleTest.class,
-  RepeatRuleTest.class,
-  RetryRuleGlobalWithErrorTest.class,
-  RetryRuleGlobalWithExceptionTest.class,
-  RetryRuleLocalWithErrorTest.class,
-  RetryRuleLocalWithExceptionTest.class,
-})
-public class JUnitRuleTestSuite {
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/RepeatRuleTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/RepeatRuleTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/RepeatRuleTest.java
deleted file mode 100755
index 2d37de4..0000000
--- a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/RepeatRuleTest.java
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.test.junit.rules.tests;
-
-import static com.gemstone.gemfire.test.junit.rules.tests.TestRunner.*;
-import static org.assertj.core.api.Assertions.*;
-
-import java.util.List;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.runner.Result;
-import org.junit.runner.notification.Failure;
-
-import com.gemstone.gemfire.test.junit.Repeat;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-import com.gemstone.gemfire.test.junit.rules.RepeatRule;
-
-/**
- * Unit tests for Repeat JUnit Rule.
- * 
- * @author Kirk Lund
- */
-@Category(UnitTest.class)
-public class RepeatRuleTest {
-
-  private static final String ASSERTION_ERROR_MESSAGE = "failing test";
-  
-  @Test
-  public void failingTestShouldFailOneTimeWhenRepeatIsUnused() {
-    Result result = runTest(FailingTestShouldFailOneTimeWhenRepeatIsUnused.class);
-    
-    assertThat(result.wasSuccessful()).isFalse();
-    
-    List<Failure> failures = result.getFailures();
-    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
-
-    Failure failure = failures.get(0);
-    assertThat(failure.getException()).isExactlyInstanceOf(AssertionError.class).hasMessage(ASSERTION_ERROR_MESSAGE);
-    assertThat(FailingTestShouldFailOneTimeWhenRepeatIsUnused.count).isEqualTo(1);
-  }
-
-  @Test
-  public void passingTestShouldPassOneTimeWhenRepeatIsUnused() {
-    Result result = runTest(PassingTestShouldPassOneTimeWhenRepeatIsUnused.class);
-    
-    assertThat(result.wasSuccessful()).isTrue();
-    assertThat(PassingTestShouldPassOneTimeWhenRepeatIsUnused.count).isEqualTo(1);
-  }
-
-  @Test
-  public void zeroValueShouldThrowIllegalArgumentException() {
-    Result result = runTest(ZeroValueShouldThrowIllegalArgumentException.class);
-    
-    assertThat(result.wasSuccessful()).isFalse();
-    
-    List<Failure> failures = result.getFailures();
-    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
-
-    Failure failure = failures.get(0);
-    assertThat(failure.getException()).isExactlyInstanceOf(IllegalArgumentException.class).hasMessage("Repeat value must be a positive integer");
-    assertThat(ZeroValueShouldThrowIllegalArgumentException.count).isEqualTo(0);
-  }
-  
-  @Test
-  public void negativeValueShouldThrowIllegalArgumentException() {
-    Result result = runTest(NegativeValueShouldThrowIllegalArgumentException.class);
-    
-    assertThat(result.wasSuccessful()).isFalse();
-    
-    List<Failure> failures = result.getFailures();
-    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
-
-    Failure failure = failures.get(0);
-    assertThat(failure.getException()).isExactlyInstanceOf(IllegalArgumentException.class).hasMessage("Repeat value must be a positive integer");
-    assertThat(NegativeValueShouldThrowIllegalArgumentException.count).isEqualTo(0);
-  }
-
-  @Test
-  public void failingTestShouldFailOneTimeWhenRepeatIsOne() {
-    Result result = runTest(FailingTestShouldFailOneTimeWhenRepeatIsOne.class);
-    
-    assertThat(result.wasSuccessful()).isFalse();
-    
-    List<Failure> failures = result.getFailures();
-    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
-
-    Failure failure = failures.get(0);
-    assertThat(failure.getException()).isExactlyInstanceOf(AssertionError.class).hasMessage(ASSERTION_ERROR_MESSAGE);
-    assertThat(FailingTestShouldFailOneTimeWhenRepeatIsOne.count).isEqualTo(1);
-  }
-
-  @Test
-  public void passingTestShouldPassOneTimeWhenRepeatIsOne() {
-    Result result = runTest(PassingTestShouldPassOneTimeWhenRepeatIsOne.class);
-    
-    assertThat(result.wasSuccessful()).isTrue();
-    assertThat(PassingTestShouldPassOneTimeWhenRepeatIsOne.count).isEqualTo(1);
-  }
-
-  @Test
-  public void failingTestShouldFailOneTimeWhenRepeatIsTwo() {
-    Result result = runTest(FailingTestShouldFailOneTimeWhenRepeatIsTwo.class);
-    
-    assertThat(result.wasSuccessful()).isFalse();
-    
-    List<Failure> failures = result.getFailures();
-    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
-
-    Failure failure = failures.get(0);
-    assertThat(failure.getException()).isExactlyInstanceOf(AssertionError.class).hasMessage(ASSERTION_ERROR_MESSAGE);
-    assertThat(FailingTestShouldFailOneTimeWhenRepeatIsTwo.count).isEqualTo(1);
-  }
-
-  @Test
-  public void passingTestShouldPassTwoTimesWhenRepeatIsTwo() {
-    Result result = runTest(PassingTestShouldPassTwoTimesWhenRepeatIsTwo.class);
-    
-    assertThat(result.wasSuccessful()).isTrue();
-    assertThat(PassingTestShouldPassTwoTimesWhenRepeatIsTwo.count).isEqualTo(2);
-  }
-
-  @Test
-  public void failingTestShouldFailOneTimeWhenRepeatIsThree() {
-    Result result = runTest(FailingTestShouldFailOneTimeWhenRepeatIsThree.class);
-    
-    assertThat(result.wasSuccessful()).isFalse();
-    
-    List<Failure> failures = result.getFailures();
-    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
-
-    Failure failure = failures.get(0);
-    assertThat(failure.getException()).isExactlyInstanceOf(AssertionError.class).hasMessage(ASSERTION_ERROR_MESSAGE);
-    assertThat(FailingTestShouldFailOneTimeWhenRepeatIsThree.count).isEqualTo(1);
-  }
-
-  @Test
-  public void passingTestShouldPassThreeTimesWhenRepeatIsThree() {
-    Result result = runTest(PassingTestShouldPassThreeTimesWhenRepeatIsThree.class);
-    
-    assertThat(result.wasSuccessful()).isTrue();
-    assertThat(PassingTestShouldPassThreeTimesWhenRepeatIsThree.count).isEqualTo(3);
-  }
-
-  public static class FailingTestShouldFailOneTimeWhenRepeatIsUnused {
-    protected static int count = 0;
-    
-    @Rule
-    public RepeatRule repeat = new RepeatRule();
-
-    @Test
-    public void doTest() throws Exception {
-      count++;
-      fail(ASSERTION_ERROR_MESSAGE);
-    }
-  }
-
-  public static class PassingTestShouldPassOneTimeWhenRepeatIsUnused {
-    protected static int count = 0;
-    
-    @Rule
-    public RepeatRule repeat = new RepeatRule();
-
-    @Test
-    public void doTest() throws Exception {
-      count++;
-    }
-  }
-
-  public static class ZeroValueShouldThrowIllegalArgumentException {
-    protected static int count = 0;
-    
-    @Rule
-    public RepeatRule repeat = new RepeatRule();
-
-    @Test
-    @Repeat(0)
-    public void doTest() throws Exception {
-      count++;
-    }
-  }
-
-  public static class NegativeValueShouldThrowIllegalArgumentException {
-    protected static int count = 0;
-    
-    @Rule
-    public RepeatRule repeat = new RepeatRule();
-
-    @Test
-    @Repeat(-1)
-    public void doTest() throws Exception {
-      count++;
-    }
-  }
-
-  public static class PassingTestShouldBeSkippedWhenRepeatIsZero {
-    protected static int count = 0;
-    
-    @Rule
-    public RepeatRule repeat = new RepeatRule();
-
-    @Test
-    @Repeat(0)
-    public void doTest() throws Exception {
-      count++;
-    }
-  }
-  
-  public static class FailingTestShouldFailOneTimeWhenRepeatIsOne {
-    protected static int count = 0;
-    
-    @Rule
-    public RepeatRule repeat = new RepeatRule();
-
-    @Test
-    @Repeat(1)
-    public void doTest() throws Exception {
-      count++;
-      fail(ASSERTION_ERROR_MESSAGE);
-    }
-  }
-
-  public static class PassingTestShouldPassOneTimeWhenRepeatIsOne {
-    protected static int count = 0;
-    
-    @Rule
-    public RepeatRule repeat = new RepeatRule();
-
-    @Test
-    @Repeat(1)
-    public void doTest() throws Exception {
-      count++;
-    }
-  }
-
-  public static class FailingTestShouldFailOneTimeWhenRepeatIsTwo {
-    protected static int count = 0;
-    
-    @Rule
-    public RepeatRule repeat = new RepeatRule();
-
-    @Test
-    @Repeat(2)
-    public void doTest() throws Exception {
-      count++;
-      fail(ASSERTION_ERROR_MESSAGE);
-    }
-  }
-
-  public static class PassingTestShouldPassTwoTimesWhenRepeatIsTwo {
-    protected static int count = 0;
-    
-    @Rule
-    public RepeatRule repeat = new RepeatRule();
-
-    @Test
-    @Repeat(2)
-    public void doTest() throws Exception {
-      count++;
-    }
-  }
-
-  public static class FailingTestShouldFailOneTimeWhenRepeatIsThree {
-    protected static int count = 0;
-    
-    @Rule
-    public RepeatRule repeat = new RepeatRule();
-
-    @Test
-    @Repeat(3)
-    public void doTest() throws Exception {
-      count++;
-      fail(ASSERTION_ERROR_MESSAGE);
-    }
-  }
-
-  public static class PassingTestShouldPassThreeTimesWhenRepeatIsThree {
-    protected static int count = 0;
-    
-    @Rule
-    public RepeatRule repeat = new RepeatRule();
-
-    @Test
-    @Repeat(3)
-    public void doTest() throws Exception {
-      count++;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/RetryRuleGlobalWithErrorTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/RetryRuleGlobalWithErrorTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/RetryRuleGlobalWithErrorTest.java
deleted file mode 100755
index 78bc410..0000000
--- a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/RetryRuleGlobalWithErrorTest.java
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.test.junit.rules.tests;
-
-import static com.gemstone.gemfire.test.junit.rules.tests.TestRunner.*;
-import static org.assertj.core.api.Assertions.*;
-import static org.junit.Assert.fail;
-
-import java.util.List;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.runner.Result;
-import org.junit.runner.notification.Failure;
-
-import com.gemstone.gemfire.test.junit.Retry;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-import com.gemstone.gemfire.test.junit.rules.RetryRule;
-
-/**
- * Unit tests for Retry JUnit Rule involving global scope (ie Rule affects all 
- * tests in the test case) with failures due to an Exception.
- * 
- * @author Kirk Lund
- */
-@Category(UnitTest.class)
-public class RetryRuleGlobalWithErrorTest {
-  
-  @Test
-  public void zeroIsIllegal() {
-    Result result = runTest(ZeroIsIllegal.class);
-    
-    assertThat(result.wasSuccessful()).isFalse();
-    
-    List<Failure> failures = result.getFailures();
-    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
-
-    Failure failure = failures.get(0);
-    assertThat(failure.getException()).isExactlyInstanceOf(IllegalArgumentException.class).hasMessage(ZeroIsIllegal.message);
-    assertThat(ZeroIsIllegal.count).isEqualTo(0);
-  }
-  
-  @Test
-  public void failsWithOne() {
-    Result result = runTest(FailsWithOne.class);
-    
-    assertThat(result.wasSuccessful()).isFalse();
-    
-    List<Failure> failures = result.getFailures();
-    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
-
-    Failure failure = failures.get(0);
-    assertThat(failure.getException()).isExactlyInstanceOf(AssertionError.class).hasMessage(FailsWithOne.message);
-    assertThat(FailsWithOne.count).isEqualTo(1);
-  }
-  
-  @Test
-  public void passesWithOne() {
-    Result result = runTest(PassesWithOne.class);
-    
-    assertThat(result.wasSuccessful()).isTrue();
-    assertThat(PassesWithOne.count).isEqualTo(1);
-  }
-  
-  @Test
-  public void passesWithUnused() {
-    Result result = runTest(PassesWhenUnused.class);
-    
-    assertThat(result.wasSuccessful()).isTrue();
-    assertThat(PassesWhenUnused.count).isEqualTo(1);
-  }
-  
-  @Test
-  public void failsOnSecondAttempt() {
-    Result result = runTest(FailsOnSecondAttempt.class);
-    
-    assertThat(result.wasSuccessful()).isFalse();
-    
-    List<Failure> failures = result.getFailures();
-    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
-
-    Failure failure = failures.get(0);
-    assertThat(failure.getException()).isExactlyInstanceOf(AssertionError.class).hasMessage(FailsOnSecondAttempt.message);
-    assertThat(FailsOnSecondAttempt.count).isEqualTo(2);
-  }
-
-  @Test
-  public void passesOnSecondAttempt() {
-    Result result = runTest(PassesOnSecondAttempt.class);
-    
-    assertThat(result.wasSuccessful()).isTrue();
-    assertThat(PassesOnSecondAttempt.count).isEqualTo(2);
-  }
-  
-  @Test
-  public void failsOnThirdAttempt() {
-    Result result = runTest(FailsOnThirdAttempt.class);
-    
-    assertThat(result.wasSuccessful()).isFalse();
-    
-    List<Failure> failures = result.getFailures();
-    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
-
-    Failure failure = failures.get(0);
-    assertThat(failure.getException()).isExactlyInstanceOf(AssertionError.class).hasMessage(FailsOnThirdAttempt.message);
-    assertThat(FailsOnThirdAttempt.count).isEqualTo(3);
-  }
-
-  @Test
-  public void passesOnThirdAttempt() {
-    Result result = runTest(PassesOnThirdAttempt.class);
-    
-    assertThat(result.wasSuccessful()).isTrue();
-    assertThat(PassesOnThirdAttempt.count).isEqualTo(3);
-  }
-  
-  public static class ZeroIsIllegal {
-    protected static int count;
-    protected static final String message = "Retry count must be greater than zero";
-
-    @Rule
-    public RetryRule retryRule = new RetryRule(0);
-
-    @Test
-    public void zeroIsIllegal() throws Exception {
-      count++;
-    }
-  }
-  
-  public static class FailsWithOne {
-    protected static int count;
-    protected static String message;
-
-    @Rule
-    public RetryRule retryRule = new RetryRule(1);
-
-    @Test
-    public void failsWithOne() throws Exception {
-      count++;
-      message = "Failing " + count;
-      fail(message);
-    }
-  }
-  
-  public static class PassesWithOne {
-    protected static int count;
-
-    @Rule
-    public RetryRule retryRule = new RetryRule(1);
-
-    @Test
-    public void passesWithOne() throws Exception {
-      count++;
-    }
-  }
-  
-  public static class PassesWhenUnused {
-    protected static int count;
-
-    @Rule
-    public RetryRule retryRule = new RetryRule(2);
-
-    @Test
-    public void passesWithUnused() throws Exception {
-      count++;
-    }
-  }
-  
-  public static class FailsOnSecondAttempt {
-    protected static int count;
-    protected static String message;
-
-    @Rule
-    public RetryRule retryRule = new RetryRule(2);
-
-    @Test
-    @Retry(2)
-    public void failsOnSecondAttempt() {
-      count++;
-      message = "Failing " + count;
-      fail(message);
-    }
-  }
-  
-  public static class PassesOnSecondAttempt {
-    protected static int count;
-    protected static String message;
-    
-    @Rule
-    public RetryRule retryRule = new RetryRule(2);
-
-    @Test
-    @Retry(2)
-    public void failsOnSecondAttempt() {
-      count++;
-      if (count < 2) {
-        message = "Failing " + count;
-        fail(message);
-      }
-    }
-  }
-  
-  public static class FailsOnThirdAttempt {
-    protected static int count;
-    protected static String message;
-
-    @Rule
-    public RetryRule retryRule = new RetryRule(3);
-
-    @Test
-    @Retry(3)
-    public void failsOnThirdAttempt() {
-      count++;
-      message = "Failing " + count;
-      fail(message);
-    }
-  }
-
-  public static class PassesOnThirdAttempt {
-    protected static int count;
-    protected static String message;
-
-    @Rule
-    public RetryRule retryRule = new RetryRule(3);
-
-    @Test
-    public void failsOnThirdAttempt() {
-      count++;
-      if (count < 3) {
-        message = "Failing " + count;
-        fail(message);
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/RetryRuleGlobalWithExceptionTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/RetryRuleGlobalWithExceptionTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/RetryRuleGlobalWithExceptionTest.java
deleted file mode 100755
index 114eeb4..0000000
--- a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/RetryRuleGlobalWithExceptionTest.java
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.test.junit.rules.tests;
-
-import static com.gemstone.gemfire.test.junit.rules.tests.TestRunner.*;
-import static org.assertj.core.api.Assertions.*;
-
-import java.util.List;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.runner.Result;
-import org.junit.runner.notification.Failure;
-
-import com.gemstone.gemfire.test.junit.Retry;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-import com.gemstone.gemfire.test.junit.rules.RetryRule;
-
-/**
- * Unit tests for Retry JUnit Rule involving global scope (ie Rule affects all 
- * tests in the test case) with failures due to an Exception.
- * 
- * @author Kirk Lund
- */
-@Category(UnitTest.class)
-public class RetryRuleGlobalWithExceptionTest {
-  
-  @Test
-  public void zeroIsIllegal() {
-    Result result = runTest(ZeroIsIllegal.class);
-    
-    assertThat(result.wasSuccessful()).isFalse();
-    
-    List<Failure> failures = result.getFailures();
-    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
-
-    Failure failure = failures.get(0);
-    assertThat(failure.getException()).isExactlyInstanceOf(IllegalArgumentException.class).hasMessage(ZeroIsIllegal.message);
-    assertThat(ZeroIsIllegal.count).isEqualTo(0);
-  }
-  
-  @Test
-  public void failsWithOne() {
-    Result result = runTest(FailsWithOne.class);
-    
-    assertThat(result.wasSuccessful()).isFalse();
-    
-    List<Failure> failures = result.getFailures();
-    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
-
-    Failure failure = failures.get(0);
-    assertThat(failure.getException()).isExactlyInstanceOf(CustomException.class).hasMessage(FailsWithOne.message);
-    assertThat(FailsWithOne.count).isEqualTo(1);
-  }
-  
-  @Test
-  public void passesWithOne() {
-    Result result = runTest(PassesWithOne.class);
-    
-    assertThat(result.wasSuccessful()).isTrue();
-  }
-  
-  @Test
-  public void passesWithUnused() {
-    Result result = runTest(PassesWhenUnused.class);
-    
-    assertThat(result.wasSuccessful()).isTrue();
-  }
-  
-  @Test
-  public void failsOnSecondAttempt() {
-    Result result = runTest(FailsOnSecondAttempt.class);
-    
-    assertThat(result.wasSuccessful()).isFalse();
-    
-    List<Failure> failures = result.getFailures();
-    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
-
-    Failure failure = failures.get(0);
-    assertThat(failure.getException()).isExactlyInstanceOf(CustomException.class).hasMessage(FailsOnSecondAttempt.message);
-    assertThat(FailsOnSecondAttempt.count).isEqualTo(2);
-  }
-
-  @Test
-  public void passesOnSecondAttempt() {
-    Result result = runTest(PassesOnSecondAttempt.class);
-    
-    assertThat(result.wasSuccessful()).isTrue();
-    assertThat(PassesOnSecondAttempt.count).isEqualTo(2);
-  }
-  
-  @Test
-  public void failsOnThirdAttempt() {
-    Result result = runTest(FailsOnThirdAttempt.class);
-    
-    assertThat(result.wasSuccessful()).isFalse();
-    
-    List<Failure> failures = result.getFailures();
-    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
-
-    Failure failure = failures.get(0);
-    assertThat(failure.getException()).isExactlyInstanceOf(CustomException.class).hasMessage(FailsOnThirdAttempt.message);
-    assertThat(FailsOnThirdAttempt.count).isEqualTo(3);
-  }
-
-  @Test
-  public void passesOnThirdAttempt() {
-    Result result = runTest(PassesOnThirdAttempt.class);
-    
-    assertThat(result.wasSuccessful()).isTrue();
-    assertThat(PassesOnThirdAttempt.count).isEqualTo(3);
-  }
-  
-  public static class CustomException extends Exception {
-    private static final long serialVersionUID = 1L;
-    public CustomException(final String message) {
-      super(message);
-    }
-  }
-  
-  public static class ZeroIsIllegal {
-    protected static int count;
-    protected static final String message = "Retry count must be greater than zero";
-
-    @Rule
-    public RetryRule retryRule = new RetryRule(0);
-
-    @Test
-    public void zeroIsIllegal() throws Exception {
-      count++;
-    }
-  }
-  
-  public static class FailsWithOne {
-    protected static int count;
-    protected static String message;
-
-    @Rule
-    public RetryRule retryRule = new RetryRule(1);
-
-    @Test
-    public void failsWithOne() throws Exception {
-      count++;
-      message = "Failing " + count;
-      throw new CustomException(message);
-    }
-  }
-  
-  public static class PassesWithOne {
-    protected static int count;
-
-    @Rule
-    public RetryRule retryRule = new RetryRule(1);
-
-    @Test
-    public void passesWithOne() throws Exception {
-      count++;
-    }
-  }
-  
-  public static class PassesWhenUnused {
-    protected static int count;
-
-    @Rule
-    public RetryRule retryRule = new RetryRule(2);
-
-    @Test
-    public void passesWithUnused() throws Exception {
-      count++;
-    }
-  }
-  
-  public static class FailsOnSecondAttempt {
-    protected static int count;
-    protected static String message;
-
-    @Rule
-    public RetryRule retryRule = new RetryRule(2);
-
-    @Test
-    @Retry(2)
-    public void failsOnSecondAttempt() throws Exception {
-      count++;
-      message = "Failing " + count;
-      throw new CustomException(message);
-    }
-  }
-  
-  public static class PassesOnSecondAttempt {
-    protected static int count;
-    protected static String message;
-    
-    @Rule
-    public RetryRule retryRule = new RetryRule(2);
-
-    @Test
-    @Retry(2)
-    public void failsOnSecondAttempt() throws Exception {
-      count++;
-      if (count < 2) {
-        message = "Failing " + count;
-        throw new CustomException(message);
-      }
-    }
-  }
-  
-  public static class FailsOnThirdAttempt {
-    protected static int count;
-    protected static String message;
-
-    @Rule
-    public RetryRule retryRule = new RetryRule(3);
-
-    @Test
-    @Retry(3)
-    public void failsOnThirdAttempt() throws Exception {
-      count++;
-      message = "Failing " + count;
-      throw new CustomException(message);
-    }
-  }
-
-  public static class PassesOnThirdAttempt {
-    protected static int count;
-    protected static String message;
-
-    @Rule
-    public RetryRule retryRule = new RetryRule(3);
-
-    @Test
-    public void failsOnThirdAttempt() throws Exception {
-      count++;
-      if (count < 3) {
-        message = "Failing " + count;
-        throw new CustomException(message);
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/RetryRuleLocalWithErrorTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/RetryRuleLocalWithErrorTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/RetryRuleLocalWithErrorTest.java
deleted file mode 100755
index af5a853..0000000
--- a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/RetryRuleLocalWithErrorTest.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.test.junit.rules.tests;
-
-import static com.gemstone.gemfire.test.junit.rules.tests.TestRunner.*;
-import static org.assertj.core.api.Assertions.*;
-import static org.junit.Assert.fail;
-
-import java.util.List;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.runner.Result;
-import org.junit.runner.notification.Failure;
-
-import com.gemstone.gemfire.test.junit.Retry;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-import com.gemstone.gemfire.test.junit.rules.RetryRule;
-
-/**
- * Unit tests for Retry JUnit Rule involving local scope (ie Rule affects 
- * test methods annotated with @Retry) with failures due to an Error.
- * 
- * @author Kirk Lund
- */
-@Category(UnitTest.class)
-public class RetryRuleLocalWithErrorTest {
-
-  @Test
-  public void failsUnused() {
-    Result result = runTest(FailsUnused.class);
-    
-    assertThat(result.wasSuccessful()).isFalse();
-    
-    List<Failure> failures = result.getFailures();
-    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
-
-    Failure failure = failures.get(0);
-    assertThat(failure.getException()).isExactlyInstanceOf(AssertionError.class).hasMessage(FailsUnused.message);
-    assertThat(FailsUnused.count).isEqualTo(1);
-  }
-  
-  @Test
-  public void passesUnused() {
-    Result result = runTest(PassesUnused.class);
-    
-    assertThat(result.wasSuccessful()).isTrue();
-    assertThat(PassesUnused.count).isEqualTo(1);
-  }
-  
-  @Test
-  public void failsOnSecondAttempt() {
-    Result result = runTest(FailsOnSecondAttempt.class);
-    
-    assertThat(result.wasSuccessful()).isFalse();
-    
-    List<Failure> failures = result.getFailures();
-    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
-
-    Failure failure = failures.get(0);
-    assertThat(failure.getException()).isExactlyInstanceOf(AssertionError.class).hasMessage(FailsOnSecondAttempt.message);
-    assertThat(FailsOnSecondAttempt.count).isEqualTo(2);
-  }
-
-  @Test
-  public void passesOnSecondAttempt() {
-    Result result = runTest(PassesOnSecondAttempt.class);
-    
-    assertThat(result.wasSuccessful()).isTrue();
-    assertThat(PassesOnSecondAttempt.count).isEqualTo(2);
-  }
-  
-  @Test
-  public void failsOnThirdAttempt() {
-    Result result = runTest(FailsOnThirdAttempt.class);
-    
-    assertThat(result.wasSuccessful()).isFalse();
-    
-    List<Failure> failures = result.getFailures();
-    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
-
-    Failure failure = failures.get(0);
-    assertThat(failure.getException()).isExactlyInstanceOf(AssertionError.class).hasMessage(FailsOnThirdAttempt.message);
-    assertThat(FailsOnThirdAttempt.count).isEqualTo(3);
-  }
-
-  @Test
-  public void passesOnThirdAttempt() {
-    Result result = runTest(PassesOnThirdAttempt.class);
-    
-    assertThat(result.wasSuccessful()).isTrue();
-    assertThat(PassesOnThirdAttempt.count).isEqualTo(3);
-  }
-  
-  public static class FailsUnused {
-    protected static int count;
-    protected static String message;
-
-    @Rule
-    public RetryRule retryRule = new RetryRule();
-
-    @Test
-    public void failsUnused() throws Exception {
-      count++;
-      message = "Failing " + count;
-      fail(message);
-    }
-  }
-  
-  public static class PassesUnused {
-    protected static int count;
-    protected static String message;
-
-    @Rule
-    public RetryRule retryRule = new RetryRule();
-
-    @Test
-    public void passesUnused() throws Exception {
-      count++;
-    }
-  }
-  
-  public static class FailsOnSecondAttempt {
-    protected static int count;
-    protected static String message;
-    
-    @Rule
-    public RetryRule retryRule = new RetryRule();
-
-    @Test
-    @Retry(2)
-    public void failsOnSecondAttempt() {
-      count++;
-      message = "Failing " + count;
-      fail(message);
-    }
-  }
-  
-  public static class PassesOnSecondAttempt {
-    protected static int count;
-    protected static String message;
-    
-    @Rule
-    public RetryRule retryRule = new RetryRule();
-
-    @Test
-    @Retry(2)
-    public void failsOnSecondAttempt() {
-      count++;
-      if (count < 2) {
-        message = "Failing " + count;
-        fail(message);
-      }
-    }
-  }
-  
-  public static class FailsOnThirdAttempt {
-    protected static int count;
-    protected static String message;
-    
-    @Rule
-    public RetryRule retryRule = new RetryRule();
-
-    @Test
-    @Retry(3)
-    public void failsOnThirdAttempt() {
-      count++;
-
-      message = "Failing " + count;
-      fail(message);
-    }
-  }
-
-  public static class PassesOnThirdAttempt {
-    protected static int count;
-    protected static String message;
-    
-    @Rule
-    public RetryRule retryRule = new RetryRule();
-
-    @Test
-    @Retry(3)
-    public void failsOnThirdAttempt() {
-      count++;
-
-      if (count < 3) {
-        message = "Failing " + count;
-        fail(message);
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/RetryRuleLocalWithExceptionTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/RetryRuleLocalWithExceptionTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/RetryRuleLocalWithExceptionTest.java
deleted file mode 100755
index 1b16a7a..0000000
--- a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/RetryRuleLocalWithExceptionTest.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.test.junit.rules.tests;
-
-import static com.gemstone.gemfire.test.junit.rules.tests.TestRunner.*;
-import static org.assertj.core.api.Assertions.*;
-
-import java.util.List;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.runner.Result;
-import org.junit.runner.notification.Failure;
-
-import com.gemstone.gemfire.test.junit.Retry;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-import com.gemstone.gemfire.test.junit.rules.RetryRule;
-
-/**
- * Unit tests for Retry JUnit Rule involving local scope (ie Rule affects 
- * test methods annotated with @Retry) with failures due to an Exception.
- * 
- * @author Kirk Lund
- */
-@Category(UnitTest.class)
-public class RetryRuleLocalWithExceptionTest {
-
-  @Test
-  public void failsUnused() {
-    Result result = runTest(FailsUnused.class);
-    
-    assertThat(result.wasSuccessful()).isFalse();
-    
-    List<Failure> failures = result.getFailures();
-    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
-
-    Failure failure = failures.get(0);
-    assertThat(failure.getException()).isExactlyInstanceOf(CustomException.class).hasMessage(FailsUnused.message);
-    assertThat(FailsUnused.count).isEqualTo(1);
-  }
-  
-  @Test
-  public void passesUnused() {
-    Result result = runTest(PassesUnused.class);
-    
-    assertThat(result.wasSuccessful()).isTrue();
-    assertThat(PassesUnused.count).isEqualTo(1);
-  }
-  
-  @Test
-  public void failsOnSecondAttempt() {
-    Result result = runTest(FailsOnSecondAttempt.class);
-    
-    assertThat(result.wasSuccessful()).isFalse();
-    
-    List<Failure> failures = result.getFailures();
-    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
-
-    Failure failure = failures.get(0);
-    assertThat(failure.getException()).isExactlyInstanceOf(CustomException.class).hasMessage(FailsOnSecondAttempt.message);
-    assertThat(FailsOnSecondAttempt.count).isEqualTo(2);
-  }
-
-  @Test
-  public void passesOnSecondAttempt() {
-    Result result = runTest(PassesOnSecondAttempt.class);
-    
-    assertThat(result.wasSuccessful()).isTrue();
-    assertThat(PassesOnSecondAttempt.count).isEqualTo(2);
-  }
-  
-  @Test
-  public void failsOnThirdAttempt() {
-    Result result = runTest(FailsOnThirdAttempt.class);
-    
-    assertThat(result.wasSuccessful()).isFalse();
-    
-    List<Failure> failures = result.getFailures();
-    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
-
-    Failure failure = failures.get(0);
-    assertThat(failure.getException()).isExactlyInstanceOf(CustomException.class).hasMessage(FailsOnThirdAttempt.message);
-    assertThat(FailsOnThirdAttempt.count).isEqualTo(3);
-  }
-
-  @Test
-  public void passesOnThirdAttempt() {
-    Result result = runTest(PassesOnThirdAttempt.class);
-    
-    assertThat(result.wasSuccessful()).isTrue();
-    assertThat(PassesOnThirdAttempt.count).isEqualTo(3);
-  }
-  
-  public static class CustomException extends Exception {
-    private static final long serialVersionUID = 1L;
-    public CustomException(final String message) {
-      super(message);
-    }
-  }
-  
-  public static class FailsUnused {
-    protected static int count;
-    protected static String message;
-
-    @Rule
-    public RetryRule retryRule = new RetryRule();
-
-    @Test
-    public void failsUnused() throws Exception {
-      count++;
-      message = "Failing " + count;
-      throw new CustomException(message);
-    }
-  }
-  
-  public static class PassesUnused {
-    protected static int count;
-    protected static String message;
-
-    @Rule
-    public RetryRule retryRule = new RetryRule();
-
-    @Test
-    public void passesUnused() throws Exception {
-      count++;
-    }
-  }
-  
-  public static class FailsOnSecondAttempt {
-    protected static int count;
-    protected static String message;
-    
-    @Rule
-    public RetryRule retryRule = new RetryRule();
-
-    @Test
-    @Retry(2)
-    public void failsOnSecondAttempt() throws Exception {
-      count++;
-      message = "Failing " + count;
-      throw new CustomException(message);
-    }
-  }
-  
-  public static class PassesOnSecondAttempt {
-    protected static int count;
-    protected static String message;
-    
-    @Rule
-    public RetryRule retryRule = new RetryRule();
-
-    @Test
-    @Retry(2)
-    public void failsOnSecondAttempt() throws Exception {
-      count++;
-      if (count < 2) {
-        message = "Failing " + count;
-        throw new CustomException(message);
-      }
-    }
-  }
-  
-  public static class FailsOnThirdAttempt {
-    protected static int count;
-    protected static String message;
-    
-    @Rule
-    public RetryRule retryRule = new RetryRule();
-
-    @Test
-    @Retry(3)
-    public void failsOnThirdAttempt() throws Exception {
-      count++;
-
-      message = "Failing " + count;
-      throw new CustomException(message);
-    }
-  }
-
-  public static class PassesOnThirdAttempt {
-    protected static int count;
-    protected static String message;
-    
-    @Rule
-    public RetryRule retryRule = new RetryRule();
-
-    @Test
-    @Retry(3)
-    public void failsOnThirdAttempt() throws Exception {
-      count++;
-
-      if (count < 3) {
-        message = "Failing " + count;
-        throw new CustomException(message);
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/RuleAndClassRuleTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/RuleAndClassRuleTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/RuleAndClassRuleTest.java
deleted file mode 100755
index 9c050e9..0000000
--- a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/RuleAndClassRuleTest.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.test.junit.rules.tests;
-
-import static com.gemstone.gemfire.test.junit.rules.tests.TestRunner.*;
-import static org.assertj.core.api.Assertions.*;
-
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.rules.TestRule;
-import org.junit.runner.Description;
-import org.junit.runner.Result;
-import org.junit.runners.model.Statement;
-
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-
-@Category(UnitTest.class)
-public class RuleAndClassRuleTest {
-
-  @Test
-  public void usingRuleAsRuleAndClassRuleShouldInvokeBeforeClass() {
-    Result result = runTest(UsingRuleAsRuleAndClassRule.class);
-    
-    assertThat(result.wasSuccessful()).isTrue();
-    assertThat(UsingRuleAsRuleAndClassRule.staticRule.beforeClassInvoked).isEqualTo(true);
-  }
-  
-  @Test
-  public void usingRuleAsRuleAndClassRuleShouldInvokeAfterClass() {
-    Result result = runTest(UsingRuleAsRuleAndClassRule.class);
-    
-    assertThat(result.wasSuccessful()).isTrue();
-    assertThat(UsingRuleAsRuleAndClassRule.staticRule.afterClassInvoked).isEqualTo(true);
-  }
-
-  @Test
-  public void usingRuleAsRuleAndClassRuleShouldInvokeBefore() {
-    Result result = runTest(UsingRuleAsRuleAndClassRule.class);
-    
-    assertThat(result.wasSuccessful()).isTrue();
-    assertThat(UsingRuleAsRuleAndClassRule.staticRule.beforeInvoked).isEqualTo(true);
-  }
-
-  @Test
-  public void usingRuleAsRuleAndClassRuleShouldInvokeAfter() {
-    Result result = runTest(UsingRuleAsRuleAndClassRule.class);
-    
-    assertThat(result.wasSuccessful()).isTrue();
-    assertThat(UsingRuleAsRuleAndClassRule.staticRule.afterInvoked).isEqualTo(true);
-  }
-
-  public static class SpyRule implements TestRule {
-    boolean beforeClassInvoked;
-    boolean afterClassInvoked;
-    boolean beforeInvoked;
-    boolean afterInvoked;
-    
-    @Override
-    public Statement apply(final Statement base, final Description description) {
-      if (description.isTest()) {
-        return statement(base);
-      } else if (description.isSuite()) {
-        return statementClass(base);
-      }
-      return base;
-    }
-
-    private Statement statement(final Statement base) {
-      return new Statement() {
-        @Override
-        public void evaluate() throws Throwable {
-          before();
-          try {
-            base.evaluate();
-          } finally {
-            after();
-          }
-        }
-      };
-    }
-    
-    private Statement statementClass(final Statement base) {
-      return new Statement() {
-        @Override
-        public void evaluate() throws Throwable {
-          beforeClass();
-          try {
-            base.evaluate();
-          } finally {
-            afterClass();
-          }
-        }
-      };
-    }
-    
-    private void beforeClass() {
-      this.beforeClassInvoked = true;
-    }
-    
-    private void afterClass() {
-      this.afterClassInvoked = true;
-    }
-    
-    private void before() {
-      this.beforeInvoked = true;
-    }
-    
-    private void after() {
-      this.afterInvoked = true;
-    }
-  };
-  
-  public static class UsingRuleAsRuleAndClassRule {
-    @ClassRule
-    public static SpyRule staticRule = new SpyRule();
-    @Rule
-    public SpyRule rule = staticRule;
-    @Test
-    public void doTest() throws Exception {
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/TestRunner.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/TestRunner.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/TestRunner.java
deleted file mode 100755
index 684f452..0000000
--- a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/tests/TestRunner.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.test.junit.rules.tests;
-
-import org.junit.runner.JUnitCore;
-import org.junit.runner.Request;
-import org.junit.runner.Result;
-
-/**
- * Used by Rule Unit Tests to execute Test Cases.
- * 
- * @author Kirk Lund
- */
-public class TestRunner {
-
-  protected TestRunner() {
-  }
-  
-  public static Result runTest(Class<?> test) {
-    JUnitCore junitCore = new JUnitCore();
-    return junitCore.run(Request.aClass(test).getRunner());
-  }
-}


[4/5] incubator-geode git commit: Clean up

Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/TestFixtureRuleTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/TestFixtureRuleTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/TestFixtureRuleTest.java
new file mode 100755
index 0000000..a3ab5ed
--- /dev/null
+++ b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/TestFixtureRuleTest.java
@@ -0,0 +1,384 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.rules;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.Result;
+
+/**
+ * Unit tests for {@link TestFixtureRule}.
+ */
+public class TestFixtureRuleTest {
+
+  @Test
+  public void methodRuleAndClassRuleShouldInvokeCallbacksInOrder() {
+    Result result = TestRunner.runTest(MethodRuleAndClassRuleInvocations.class);
+
+    assertThat(result.wasSuccessful()).isTrue();
+    assertThat(MethodRuleAndClassRuleInvocations.invocations().beforeClassInvocation).isEqualTo(1);
+    assertThat(MethodRuleAndClassRuleInvocations.invocations().beforeInvocation).isEqualTo(2);
+    assertThat(MethodRuleAndClassRuleInvocations.invocations().testInvocation).isEqualTo(3);
+    assertThat(MethodRuleAndClassRuleInvocations.invocations().afterInvocation).isEqualTo(4);
+    assertThat(MethodRuleAndClassRuleInvocations.invocations().afterClassInvocation).isEqualTo(5);
+  }
+
+  @Test
+  public void methodRuleShouldInvokeCallbacksInOrder() {
+    Result result = TestRunner.runTest(MethodRuleInvocations.class);
+
+    assertThat(result.wasSuccessful()).isTrue();
+    assertThat(MethodRuleInvocations.invocations().beforeClassInvocation).isEqualTo(0);
+    assertThat(MethodRuleInvocations.invocations().beforeInvocation).isEqualTo(1);
+    assertThat(MethodRuleInvocations.invocations().testInvocation).isEqualTo(2);
+    assertThat(MethodRuleInvocations.invocations().afterInvocation).isEqualTo(3);
+    assertThat(MethodRuleInvocations.invocations().afterClassInvocation).isEqualTo(0);
+  }
+
+  @Test
+  public void classRuleShouldInvokeCallbacksInOrder() {
+    Result result = TestRunner.runTest(ClassRuleInvocations.class);
+
+    assertThat(result.wasSuccessful()).isTrue();
+    assertThat(ClassRuleInvocations.invocations().beforeClassInvocation).isEqualTo(1);
+    assertThat(ClassRuleInvocations.invocations().beforeInvocation).isEqualTo(0);
+    assertThat(ClassRuleInvocations.invocations().testInvocation).isEqualTo(2);
+    assertThat(ClassRuleInvocations.invocations().afterInvocation).isEqualTo(0);
+    assertThat(ClassRuleInvocations.invocations().afterClassInvocation).isEqualTo(3);
+  }
+
+  @Test
+  public void beforeClassThrowsExceptionShouldSkipBeforeTestAndAfterClass() {
+    Result result = TestRunner.runTest(BeforeClassThrowsException.class);
+
+    assertThat(result.wasSuccessful()).isFalse();
+    assertThat(BeforeClassThrowsException.invocations().beforeClassInvocation).isEqualTo(1);
+    assertThat(BeforeClassThrowsException.invocations().beforeInvocation).isEqualTo(0);
+    assertThat(BeforeClassThrowsException.invocations().testInvocation).isEqualTo(0);
+    assertThat(BeforeClassThrowsException.invocations().afterInvocation).isEqualTo(0);
+    assertThat(BeforeClassThrowsException.invocations().afterClassInvocation).isEqualTo(0);
+  }
+
+  @Test
+  public void beforeClassThrowsErrorShouldSkipBeforeTestAndAfterClass() {
+    Result result = TestRunner.runTest(BeforeClassThrowsError.class);
+
+    assertThat(result.wasSuccessful()).isFalse();
+    assertThat(BeforeClassThrowsError.invocations().beforeClassInvocation).isEqualTo(1);
+    assertThat(BeforeClassThrowsError.invocations().beforeInvocation).isEqualTo(0);
+    assertThat(BeforeClassThrowsError.invocations().testInvocation).isEqualTo(0);
+    assertThat(BeforeClassThrowsError.invocations().afterInvocation).isEqualTo(0);
+    assertThat(BeforeClassThrowsError.invocations().afterClassInvocation).isEqualTo(0);
+  }
+
+  @Test
+  public void beforeThrowsExceptionShouldSkipTestAndAfter() {
+    Result result = TestRunner.runTest(BeforeThrowsException.class);
+
+    assertThat(result.wasSuccessful()).isFalse();
+    assertThat(BeforeThrowsException.invocations().beforeClassInvocation).isEqualTo(1);
+    assertThat(BeforeThrowsException.invocations().beforeInvocation).isEqualTo(2);
+    assertThat(BeforeThrowsException.invocations().testInvocation).isEqualTo(0);
+    assertThat(BeforeThrowsException.invocations().afterInvocation).isEqualTo(0);
+    assertThat(BeforeThrowsException.invocations().afterClassInvocation).isEqualTo(3);
+  }
+
+  @Test
+  public void beforeThrowsErrorShouldSkipTestAndAfter() {
+    Result result = TestRunner.runTest(BeforeThrowsError.class);
+
+    assertThat(result.wasSuccessful()).isFalse();
+    assertThat(BeforeThrowsError.invocations().beforeClassInvocation).isEqualTo(1);
+    assertThat(BeforeThrowsError.invocations().beforeInvocation).isEqualTo(2);
+    assertThat(BeforeThrowsError.invocations().testInvocation).isEqualTo(0);
+    assertThat(BeforeThrowsError.invocations().afterInvocation).isEqualTo(0);
+    assertThat(BeforeThrowsError.invocations().afterClassInvocation).isEqualTo(3);
+  }
+
+  /**
+   * Used by test {@link #methodRuleAndClassRuleShouldInvokeCallbacksInOrder()}
+   */
+  public static class MethodRuleAndClassRuleInvocations {
+
+    @ClassRule
+    public static SpyRule staticRule = new SpyRule(new Invocations());
+
+    @Rule
+    public SpyRule rule = staticRule;
+
+    static Invocations invocations() {
+      return staticRule.invocations;
+    }
+
+    @Test
+    public void doTest() throws Exception {
+      rule.test();
+    }
+  }
+
+  /**
+   * Used by test {@link #classRuleShouldInvokeCallbacksInOrder()}
+   */
+  public static class ClassRuleInvocations {
+
+    @ClassRule
+    public static SpyRule staticRule = new SpyRule(new Invocations());
+
+    static Invocations invocations() {
+      return staticRule.invocations;
+    }
+
+    @Test
+    public void doTest() throws Exception {
+      staticRule.test();
+    }
+  }
+
+  /**
+   * Used by test {@link #methodRuleShouldInvokeCallbacksInOrder()}
+   */
+  public static class MethodRuleInvocations {
+
+    // do NOT use @ClassRule
+    static SpyRule staticSpy = new SpyRule(new Invocations());
+
+    @Rule
+    public SpyRule rule = staticSpy;
+
+    static Invocations invocations() {
+      return staticSpy.invocations;
+    }
+
+    @Test
+    public void doTest() throws Exception {
+      rule.test();
+    }
+  }
+
+  public static class BeforeClassThrowsException {
+
+    static final Throwable throwable = new Exception("Thrown by BeforeClassThrowsException");
+
+    @ClassRule
+    public static SpyRule staticRule = SpyRule.builder()
+        .withInvocations(new Invocations())
+        .beforeClassThrows(throwable)
+        .build();
+
+    @Rule
+    public SpyRule rule = staticRule;
+
+    static Invocations invocations() {
+      return staticRule.invocations;
+    }
+
+    @Test
+    public void doTest() throws Exception {
+      rule.test();
+    }
+  }
+
+  public static class BeforeClassThrowsError {
+
+    static final Throwable throwable = new Error("Thrown by BeforeClassThrowsError");
+
+    @ClassRule
+    public static SpyRule staticRule = SpyRule.builder()
+        .withInvocations(new Invocations())
+        .beforeClassThrows(throwable)
+        .build();
+
+    @Rule
+    public SpyRule rule = staticRule;
+
+    static Invocations invocations() {
+      return staticRule.invocations;
+    }
+
+    @Test
+    public void doTest() throws Exception {
+      rule.test();
+    }
+  }
+
+  public static class BeforeThrowsException {
+
+    static final Throwable throwable = new Exception("Thrown by BeforeThrowsException");
+
+    @ClassRule
+    public static SpyRule staticRule = SpyRule.builder()
+      .withInvocations(new Invocations())
+      .beforeThrows(throwable)
+      .build();
+
+    @Rule
+    public SpyRule rule = staticRule;
+
+    static Invocations invocations() {
+      return staticRule.invocations;
+    }
+
+    @Test
+    public void doTest() throws Exception {
+      rule.test();
+    }
+  }
+
+  public static class BeforeThrowsError {
+
+    static final Throwable throwable = new Error("Thrown by BeforeThrowsError");
+
+    @ClassRule
+    public static SpyRule staticRule = SpyRule.builder()
+        .withInvocations(new Invocations())
+        .beforeThrows(throwable)
+        .build();
+
+    @Rule
+    public SpyRule rule = staticRule;
+
+    static Invocations invocations() {
+      return staticRule.invocations;
+    }
+
+    @Test
+    public void doTest() throws Exception {
+      rule.test();
+    }
+  }
+
+  /**
+   * Structure of rule callback and test invocations
+   */
+  public static class Invocations {
+    int invocation = 0;
+    int beforeClassInvocation = 0;
+    int afterClassInvocation = 0;
+    int beforeInvocation = 0;
+    int afterInvocation = 0;
+    int testInvocation = 0;
+
+    void invokedTest() {
+      testInvocation = ++invocation;
+    }
+    void invokedBeforeClass() {
+      beforeClassInvocation = ++invocation;
+    }
+    void invokedAfterClass() {
+      afterClassInvocation = ++invocation;
+    }
+    void invokedBefore() {
+      beforeInvocation = ++invocation;
+    }
+    void invokedAfter() {
+      afterInvocation = ++invocation;
+    }
+  }
+
+  /**
+   * Implementation of TestRule that records the order of callbacks invoked on
+   * it. Used by {@link TestFixtureRuleTest}.
+   */
+  public static class SpyRule extends TestFixtureRule {
+
+    static SpyRuleBuilder builder() {
+      return new SpyRuleBuilder();
+    }
+
+    private final Invocations invocations;
+    private final Throwable beforeClassThrowable;
+    private final Throwable beforeThrowable;
+
+    SpyRule(Invocations invocations) {
+      this.invocations = invocations;
+      this.beforeClassThrowable = null;
+      this.beforeThrowable = null;
+    }
+
+    SpyRule(SpyRuleBuilder builder) {
+      this.invocations = builder.invocations;
+      this.beforeClassThrowable = builder.beforeClassThrowable;
+      this.beforeThrowable = builder.beforeThrowable;
+    }
+
+    Invocations invocations() {
+      return this.invocations;
+    }
+
+    void test() {
+      this.invocations.invokedTest();
+    }
+
+    @Override
+    protected void beforeClass() throws Throwable {
+      this.invocations.invokedBeforeClass();
+      if (this.beforeClassThrowable != null) {
+        throw this.beforeClassThrowable;
+      }
+    }
+
+    @Override
+    protected void afterClass() {
+      this.invocations.invokedAfterClass();
+    }
+
+    @Override
+    protected void before() throws Throwable {
+      this.invocations.invokedBefore();
+      if (this.beforeThrowable != null) {
+        throw this.beforeThrowable;
+      }
+    }
+
+    @Override
+    protected void after() {
+      this.invocations.invokedAfter();
+    }
+  }
+
+  /**
+   * Builder for more control of constructing an instance of {@link SpyRule}
+   */
+  public static class SpyRuleBuilder {
+
+    Invocations invocations;
+    Throwable beforeClassThrowable;
+    Throwable beforeThrowable;
+
+    SpyRuleBuilder withInvocations(Invocations invocations) {
+      this.invocations = invocations;
+      return this;
+    }
+
+    SpyRuleBuilder beforeClassThrows(Throwable throwable) {
+      this.beforeClassThrowable = throwable;
+      return this;
+    }
+
+    SpyRuleBuilder beforeThrows(Throwable throwable) {
+      this.beforeThrowable = throwable;
+      return this;
+    }
+
+    SpyRule build() {
+      return new SpyRule(this);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/TestRunner.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/TestRunner.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/TestRunner.java
index 1ef85fc..86addb5 100755
--- a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/TestRunner.java
+++ b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/TestRunner.java
@@ -21,15 +21,13 @@ import org.junit.runner.Request;
 import org.junit.runner.Result;
 
 /**
- * Used by JUnit rule unit tests to execute test cases.
- * 
- * @author Kirk Lund
+ * Used by JUnit rule unit tests to execute inner test cases.
  */
 public class TestRunner {
 
   protected TestRunner() {
   }
-  
+
   public static Result runTest(Class<?> test) {
     JUnitCore junitCore = new JUnitCore();
     return junitCore.run(Request.aClass(test).getRunner());

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/examples/RepeatingTestCasesExampleTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/examples/RepeatingTestCasesExampleTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/examples/RepeatingTestCasesExampleTest.java
index 5ee647b..443bb8f 100755
--- a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/examples/RepeatingTestCasesExampleTest.java
+++ b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/examples/RepeatingTestCasesExampleTest.java
@@ -43,10 +43,10 @@ import com.gemstone.gemfire.test.junit.rules.RepeatRule;
 @Category(UnitTest.class)
 public class RepeatingTestCasesExampleTest {
 
-  private static AtomicInteger repeatOnceCounter = new AtomicInteger(0);
-  private static AtomicInteger repeatOnlyOnceCounter = new AtomicInteger(0);
-  private static AtomicInteger repeatTenTimesCounter = new AtomicInteger(0);
-  private static AtomicInteger repeatTwiceCounter = new AtomicInteger(0);
+  private static final AtomicInteger repeatOnceCounter = new AtomicInteger(0);
+  private static final AtomicInteger repeatOnlyOnceCounter = new AtomicInteger(0);
+  private static final AtomicInteger repeatTenTimesCounter = new AtomicInteger(0);
+  private static final AtomicInteger repeatTwiceCounter = new AtomicInteger(0);
 
   @Rule
   public RepeatRule repeatRule = new RepeatRule();
@@ -54,6 +54,10 @@ public class RepeatingTestCasesExampleTest {
   @BeforeClass
   public static void setupBeforeClass() {
     System.setProperty("tdd.example.test.case.two.repetitions", "2");
+    repeatOnceCounter.set(0);
+    repeatOnlyOnceCounter.set(0);
+    repeatTenTimesCounter.set(0);
+    repeatTwiceCounter.set(0);
   }
 
   @AfterClass

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/examples/RetryRuleExampleTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/examples/RetryRuleExampleTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/examples/RetryRuleExampleTest.java
index 257786e..3561169 100755
--- a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/examples/RetryRuleExampleTest.java
+++ b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/examples/RetryRuleExampleTest.java
@@ -20,6 +20,7 @@ import static org.assertj.core.api.Assertions.*;
 
 import com.gemstone.gemfire.test.junit.categories.UnitTest;
 import com.gemstone.gemfire.test.junit.rules.RetryRule;
+import org.junit.BeforeClass;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -30,11 +31,16 @@ import org.junit.experimental.categories.Category;
 @Category(UnitTest.class)
 public class RetryRuleExampleTest {
 
-  @Rule
-  public final transient RetryRule retry = new RetryRule(2);
-  
   private static int count = 0;
 
+  @Rule
+  public RetryRule retry = new RetryRule(2);
+
+  @BeforeClass
+  public static void beforeClass() {
+    count = 0;
+  }
+
   @Test
   public void unreliableTestWithRaceConditions() {
     count++;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/examples/RuleAndClassRuleTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/examples/RuleAndClassRuleTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/examples/RuleAndClassRuleTest.java
index 27aa9f8..0b79c70 100755
--- a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/examples/RuleAndClassRuleTest.java
+++ b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/examples/RuleAndClassRuleTest.java
@@ -67,11 +67,15 @@ public class RuleAndClassRuleTest {
     assertThat(UsingRuleAsRuleAndClassRule.staticRule.afterInvoked).isEqualTo(true);
   }
 
+  /**
+   * Implementation of TestRule that records the callbacks invoked on it. Used
+   * by {@link UsingRuleAsRuleAndClassRule}.
+   */
   public static class SpyRule implements TestRule {
-    boolean beforeClassInvoked;
-    boolean afterClassInvoked;
-    boolean beforeInvoked;
-    boolean afterInvoked;
+    boolean beforeClassInvoked = false;
+    boolean afterClassInvoked = false;
+    boolean beforeInvoked = false;
+    boolean afterInvoked = false;
     
     @Override
     public Statement apply(final Statement base, final Description description) {
@@ -126,8 +130,11 @@ public class RuleAndClassRuleTest {
     private void after() {
       this.afterInvoked = true;
     }
-  };
-  
+  }
+
+  /**
+   * Used by the tests in {@link RuleAndClassRuleTest}.
+   */
   public static class UsingRuleAsRuleAndClassRule {
     @ClassRule
     public static SpyRule staticRule = new SpyRule();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableExternalResourceTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableExternalResourceTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableExternalResourceTest.java
index 7b4aa6e..068328b 100755
--- a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableExternalResourceTest.java
+++ b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableExternalResourceTest.java
@@ -36,9 +36,9 @@ public class SerializableExternalResourceTest {
   @Test
   public void hasZeroFields() throws Exception {
     Field[] fields = ExternalResource.class.getDeclaredFields();
-    for (Field field : fields) {
-      //System.out.println("Field: " + field);
-    }
+    /*for (Field field : fields) {
+      System.out.println("Field: " + field);
+    }*/
     assertThat(fields.length).isEqualTo(0);
   }
 
@@ -67,7 +67,7 @@ public class SerializableExternalResourceTest {
    */
   private static class FakeSerializableExternalResource extends SerializableExternalResource {
 
-    private int value;
+    private int value = -1;
 
     public FakeSerializableExternalResource value(final int value) {
       this.value = value;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableRuleListTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableRuleListTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableRuleListTest.java
index 91c3a25..ebd4b91 100755
--- a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableRuleListTest.java
+++ b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableRuleListTest.java
@@ -33,8 +33,6 @@ import java.io.Serializable;
 @Category(UnitTest.class)
 public class SerializableRuleListTest {
 
-  private String value = "foo";
-
   @Test
   public void isSerializable() throws Exception {
     assertThat(SerializableRuleList.class).isInstanceOf(Serializable.class);
@@ -42,7 +40,8 @@ public class SerializableRuleListTest {
 
   @Test
   public void canBeSerialized() throws Exception {
-    FakeSerializableTestRule fakeRule = new FakeSerializableTestRule().value(this.value);
+    String value = "foo";
+    FakeSerializableTestRule fakeRule = new FakeSerializableTestRule().value(value);
     SerializableRuleList instance = new SerializableRuleList().add(fakeRule);
 
     SerializableRuleList cloned = (SerializableRuleList) SerializationUtils.clone(instance);
@@ -52,11 +51,11 @@ public class SerializableRuleListTest {
   }
 
   /**
-   * Fake SerializableTestRule containing a string field and overriding equals.
+   * Fake SerializableTestRule with a string field and overriding equals.
    */
   private static class FakeSerializableTestRule implements SerializableTestRule {
 
-    private String value;
+    private String value = null;
 
     public FakeSerializableTestRule value(final String value) {
       this.value = value;
@@ -84,7 +83,7 @@ public class SerializableRuleListTest {
 
       FakeSerializableTestRule that = (FakeSerializableTestRule) o;
 
-      return this.value != null ? this.value.equals(that.value) : that.value == null;
+      return this.value != null ? this.value.equals(that.value()) : that.value() == null;
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTemporaryFolderTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTemporaryFolderTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTemporaryFolderTest.java
index 10d07b9..de5b6ce 100755
--- a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTemporaryFolderTest.java
+++ b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTemporaryFolderTest.java
@@ -43,9 +43,9 @@ public class SerializableTemporaryFolderTest {
   @Test
   public void hasTwoFields() throws Exception {
     Field[] fields = TemporaryFolder.class.getDeclaredFields();
-    for (Field field : fields) {
-      //System.out.println("Field: " + field);
-    }
+    /*for (Field field : fields) {
+      System.out.println("Field: " + field);
+    }*/
     assertThat(fields.length).isEqualTo(2);
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestFixtureRuleTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestFixtureRuleTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestFixtureRuleTest.java
index f1e7004..cf09e05 100755
--- a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestFixtureRuleTest.java
+++ b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestFixtureRuleTest.java
@@ -56,7 +56,7 @@ public class SerializableTestFixtureRuleTest {
    */
   private static class FakeSerializableTestFixtureRule extends SerializableTestFixtureRule {
 
-    private int value = 0;
+    private int value = -1;
 
     public FakeSerializableTestFixtureRule value(final int value) {
       this.value = value;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestNameTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestNameTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestNameTest.java
index 383314c..3c3b274 100755
--- a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestNameTest.java
+++ b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestNameTest.java
@@ -20,8 +20,10 @@ import static com.gemstone.gemfire.test.junit.rules.serializable.FieldsOfTestNam
 import static org.assertj.core.api.Assertions.*;
 import static org.mockito.Mockito.*;
 
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
 import org.apache.commons.lang.SerializationUtils;
 import org.junit.Test;
+import org.junit.experimental.categories.Category;
 import org.junit.rules.TestName;
 import org.junit.runner.Description;
 
@@ -31,14 +33,15 @@ import java.lang.reflect.Field;
 /**
  * Unit tests for {@link SerializableTestName}.
  */
+@Category(UnitTest.class)
 public class SerializableTestNameTest {
 
   @Test
   public void hasOneFields() throws Exception {
     Field[] fields = TestName.class.getDeclaredFields();
-    for (Field field : fields) {
-      //System.out.println("Field: " + field);
-    }
+    /*for (Field field : fields) {
+      System.out.println("Field: " + field);
+    }*/
     assertThat(fields.length).isEqualTo(1);
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestWatcherTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestWatcherTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestWatcherTest.java
index 5fb2e56..bda7fc5 100755
--- a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestWatcherTest.java
+++ b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestWatcherTest.java
@@ -36,9 +36,9 @@ public class SerializableTestWatcherTest {
   @Test
   public void hasZeroFields() throws Exception {
     Field[] fields = TestWatcher.class.getDeclaredFields();
-    for (Field field : fields) {
-      //System.out.println("Field: " + field);
-    }
+    /*for (Field field : fields) {
+      System.out.println("Field: " + field);
+    }*/
     assertThat(fields.length).isEqualTo(0);
   }
 
@@ -67,7 +67,7 @@ public class SerializableTestWatcherTest {
    */
   private static class FakeSerializableTestWatcher extends SerializableTestWatcher {
 
-    private int value = 0;
+    private int value = -1;
 
     private FakeSerializableTestWatcher value(final int value) {
       this.value = value;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTimeoutTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTimeoutTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTimeoutTest.java
index 92a4cd2..543676f 100755
--- a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTimeoutTest.java
+++ b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTimeoutTest.java
@@ -39,9 +39,9 @@ public class SerializableTimeoutTest {
   @Test
   public void hasThreeFields() throws Exception {
     Field[] fields = Timeout.class.getDeclaredFields();
-    for (Field field : fields) {
-      //System.out.println("Field: " + field);
-    }
+    /*for (Field field : fields) {
+      System.out.println("Field: " + field);
+    }*/
     assertThat(fields.length).isEqualTo(3);
   }
 
@@ -95,10 +95,14 @@ public class SerializableTimeoutTest {
         .withLookingForStuckThread(lookingForStuckThread)
         .build();
 
-    SerializableTimeout cloned = (SerializableTimeout) SerializationUtils.clone(instance);
-
     assertThat(readField(Timeout.class, instance, FIELD_TIMEOUT)).isEqualTo(timeout);
     assertThat(readField(Timeout.class, instance, FIELD_TIME_UNIT)).isEqualTo(timeUnit);
     assertThat(readField(Timeout.class, instance, FIELD_LOOK_FOR_STUCK_THREAD)).isEqualTo(lookingForStuckThread);
+
+    SerializableTimeout cloned = (SerializableTimeout) SerializationUtils.clone(instance);
+
+    assertThat(readField(Timeout.class, cloned, FIELD_TIMEOUT)).isEqualTo(timeout);
+    assertThat(readField(Timeout.class, cloned, FIELD_TIME_UNIT)).isEqualTo(timeUnit);
+    assertThat(readField(Timeout.class, cloned, FIELD_LOOK_FOR_STUCK_THREAD)).isEqualTo(lookingForStuckThread);
   }
 }


[5/5] incubator-geode git commit: Clean up

Posted by kl...@apache.org.
Clean up


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/7aba9ae0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/7aba9ae0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/7aba9ae0

Branch: refs/heads/feature/GEODE-953
Commit: 7aba9ae029e54258b5fdc333fa0e26d70583e4bf
Parents: f2487a4
Author: Kirk Lund <kl...@pivotal.io>
Authored: Tue Feb 23 09:44:59 2016 -0800
Committer: Kirk Lund <kl...@pivotal.io>
Committed: Tue Feb 23 09:44:59 2016 -0800

----------------------------------------------------------------------
 .../gemfire/test/dunit/rules/RemoteInvoker.java |   9 +-
 .../com/gemstone/gemfire/test/junit/Repeat.java |   2 +-
 .../test/junit/categories/ContainerTest.java    |   1 +
 .../test/junit/categories/DistributedTest.java  |   1 +
 .../test/junit/categories/HydraTest.java        |   1 +
 .../test/junit/categories/IntegrationTest.java  |   1 +
 .../test/junit/categories/PerformanceTest.java  |   1 +
 .../gemfire/test/junit/categories/UITest.java   |   1 +
 .../gemfire/test/junit/categories/UnitTest.java |  12 +-
 .../gemfire/test/junit/categories/WanTest.java  |   1 +
 .../test/junit/rules/ExpectedTimeoutRule.java   |  43 ++-
 .../gemfire/test/junit/rules/RuleList.java      | 189 ++++-----
 .../test/junit/rules/TestFixtureRule.java       | 294 +++++++-------
 .../rules/serializable/FieldsOfTestName.java    |   2 +-
 .../serializable/SerializableRuleList.java      |   2 +-
 .../SerializableTemporaryFolder.java            |   1 -
 .../serializable/SerializableTestRule.java      |   3 -
 .../serializable/SerializableTestWatcher.java   |   4 +-
 .../rules/serializable/SerializableTimeout.java |  12 +-
 .../junit/support/DefaultIgnoreCondition.java   |   2 +-
 .../junit/rules/ExpectedTimeoutRuleTest.java    |  73 +++-
 .../test/junit/rules/IgnoreUntilRuleTest.java   |  50 ++-
 .../test/junit/rules/RepeatRuleTest.java        | 157 ++++++--
 .../rules/RetryRuleGlobalWithErrorTest.java     | 138 +++++--
 .../rules/RetryRuleGlobalWithExceptionTest.java | 142 +++++--
 .../rules/RetryRuleLocalWithErrorTest.java      | 115 ++++--
 .../rules/RetryRuleLocalWithExceptionTest.java  | 119 ++++--
 .../gemfire/test/junit/rules/RuleListTest.java  | 215 +++++++++++
 .../test/junit/rules/TestFixtureRuleTest.java   | 384 +++++++++++++++++++
 .../gemfire/test/junit/rules/TestRunner.java    |   6 +-
 .../examples/RepeatingTestCasesExampleTest.java |  12 +-
 .../rules/examples/RetryRuleExampleTest.java    |  12 +-
 .../rules/examples/RuleAndClassRuleTest.java    |  19 +-
 .../SerializableExternalResourceTest.java       |   8 +-
 .../serializable/SerializableRuleListTest.java  |  11 +-
 .../SerializableTemporaryFolderTest.java        |   6 +-
 .../SerializableTestFixtureRuleTest.java        |   2 +-
 .../serializable/SerializableTestNameTest.java  |   9 +-
 .../SerializableTestWatcherTest.java            |   8 +-
 .../serializable/SerializableTimeoutTest.java   |  14 +-
 40 files changed, 1592 insertions(+), 490 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/RemoteInvoker.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/RemoteInvoker.java b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/RemoteInvoker.java
index 278250b..98dbc2f 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/RemoteInvoker.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/RemoteInvoker.java
@@ -24,13 +24,14 @@ import java.io.Serializable;
 import com.gemstone.gemfire.test.dunit.SerializableRunnable;
 
 /**
- * Provides remote invocation support to a <code>TestRule</code>. These
- * methods will invoke a SerializableRunnable in all remote DUnit JVMs
- * including the Locator JVM.
+ * Provides remote invocation support to a {@code TestRule}. These methods
+ * will invoke a SerializableRunnable in all remote DUnit JVMs including the
+ * Locator JVM.
  */
-@SuppressWarnings("serial")
 class RemoteInvoker implements Serializable {
 
+  private static final long serialVersionUID = -1759722991299584649L;
+
   public void invokeEverywhere(final SerializableRunnable runnable) {
     try {
       runnable.run();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/Repeat.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/Repeat.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/Repeat.java
index 5cfa321..01434de 100755
--- a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/Repeat.java
+++ b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/Repeat.java
@@ -31,7 +31,7 @@ import java.lang.annotation.Target;
  */
 @Documented
 @Retention(RetentionPolicy.RUNTIME)
-@Target({ ElementType.METHOD })
+@Target(ElementType.METHOD)
 @SuppressWarnings("unused")
 public @interface Repeat {
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/ContainerTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/ContainerTest.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/ContainerTest.java
index 8eec738..dbafa34 100755
--- a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/ContainerTest.java
+++ b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/ContainerTest.java
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 package com.gemstone.gemfire.test.junit.categories;
+
 /**
  * JUnit Test Category that specifies a test executes within a container
  * environment such as an OSGi server.

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/DistributedTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/DistributedTest.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/DistributedTest.java
old mode 100644
new mode 100755
index 6aa538b..c9253f9
--- a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/DistributedTest.java
+++ b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/DistributedTest.java
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 package com.gemstone.gemfire.test.junit.categories;
+
 /**
  * JUnit Test Category that specifies a test involving multiple members of a
  * distributed system.

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/HydraTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/HydraTest.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/HydraTest.java
index 4fe535b..ed21455 100755
--- a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/HydraTest.java
+++ b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/HydraTest.java
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 package com.gemstone.gemfire.test.junit.categories;
+
 /**
  * JUnit Test Category that specifies a hydra test.
  *  

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/IntegrationTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/IntegrationTest.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/IntegrationTest.java
old mode 100644
new mode 100755
index 1be6e45..eabc288
--- a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/IntegrationTest.java
+++ b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/IntegrationTest.java
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 package com.gemstone.gemfire.test.junit.categories;
+
 /**
  * JUnit Test Category that specifies a test involving inter-operation of 
  * components or subsystems.

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/PerformanceTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/PerformanceTest.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/PerformanceTest.java
old mode 100644
new mode 100755
index ad952be..7776112
--- a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/PerformanceTest.java
+++ b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/PerformanceTest.java
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 package com.gemstone.gemfire.test.junit.categories;
+
 /**
  * JUnit Test Category that specifies a test that measures performance.
  *  

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/UITest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/UITest.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/UITest.java
old mode 100644
new mode 100755
index 834931a..5f151cc
--- a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/UITest.java
+++ b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/UITest.java
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 package com.gemstone.gemfire.test.junit.categories;
+
 /**
  * JUnit Test Category that specifies a test involving a browser present to test the UI
  *  

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/UnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/UnitTest.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/UnitTest.java
old mode 100644
new mode 100755
index d5be9e8..2d887c4
--- a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/UnitTest.java
+++ b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/UnitTest.java
@@ -15,11 +15,21 @@
  * limitations under the License.
  */
 package com.gemstone.gemfire.test.junit.categories;
+
 /**
  * JUnit Test Category that specifies a test with very narrow and well defined
  * scope. Any complex dependencies and interactions are stubbed or mocked.
- *  
+ *
+ * <p><ul>A {@code UnitTest} should <bold>not<bold> do any of the following:
+ * <li>communicate with a database
+ * <li>communicate across the network
+ * <li>access the file system
+ * <li>prevent the running of other unit tests in parallel
+ * <li>require anything special in the environment (such as editing config files or running an external process)
+ * </ul>
+ *
  * @author Kirk Lund
+ * @see <a href="http://www.artima.com/weblogs/viewpost.jsp?thread=126923">A Set of Unit Testing Rules by Michael Feathers</a>
  */
 public interface UnitTest {
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/WanTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/WanTest.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/WanTest.java
old mode 100644
new mode 100755
index 9abf15b..357e4ef
--- a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/WanTest.java
+++ b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/WanTest.java
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 package com.gemstone.gemfire.test.junit.categories;
+
 /**
  * Tests Wan Feature.
  * 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/ExpectedTimeoutRule.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/ExpectedTimeoutRule.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/ExpectedTimeoutRule.java
index 7b6d345..3b02236 100755
--- a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/ExpectedTimeoutRule.java
+++ b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/ExpectedTimeoutRule.java
@@ -64,19 +64,30 @@ public class ExpectedTimeoutRule implements TestRule {
     return this;
   }
 
+  /**
+   * This method does nothing.
+   *
+   * @deprecated AssertionErrors are handled by default
+   */
+  @Deprecated
   public ExpectedTimeoutRule handleAssertionErrors() {
     this.delegate.handleAssertionErrors();
     return this;
   }
-  
+
+  /**
+   * This method does nothing.
+   *
+   * @deprecated AssumptionViolatedExceptions are handled by default
+   */
+  @Deprecated
   public ExpectedTimeoutRule handleAssumptionViolatedExceptions() {
     this.delegate.handleAssumptionViolatedExceptions();
     return this;
   }
   
   /**
-   * Adds {@code matcher} to the list of requirements for any thrown
-   * exception.
+   * Adds {@code matcher} to the list of requirements for any thrown exception.
    */
   public void expect(final Matcher<?> matcher) {
     this.delegate.expect(matcher);
@@ -84,7 +95,7 @@ public class ExpectedTimeoutRule implements TestRule {
 
   /**
    * Adds to the list of requirements for any thrown exception that it should
-   * be an instance of {@code type}
+   * be an instance of {@code type}.
    */
   public void expect(final Class<? extends Throwable> type) {
     this.delegate.expect(type);
@@ -115,23 +126,29 @@ public class ExpectedTimeoutRule implements TestRule {
     this.delegate.expectCause(expectedCause);
   }
 
-  public boolean expectsTimeout() {
-    return minDuration > 0 || maxDuration > 0;
+  /**
+   * Returns true if a timeout is expected.
+   */
+  protected boolean expectsTimeout() {
+    return this.minDuration > 0 || this.maxDuration > 0;
   }
-  
-  public boolean expectsThrowable() {
-    return expectsThrowable = true;
+
+  /**
+   * Returns true if a Throwable is expected.
+   */
+  protected boolean expectsThrowable() {
+    return this.expectsThrowable;
   }
   
   @Override
   public Statement apply(final Statement base, final Description description) {
-    Statement next = delegate.apply(base, description);
+    Statement next = this.delegate.apply(base, description);
     return new ExpectedTimeoutStatement(next);
   }
   
   private void handleTime(final Long duration) {
     if (expectsTimeout()) {
-      assertThat(timeUnit.convert(duration, TimeUnit.NANOSECONDS), new TimeMatcher(timeUnit, minDuration, maxDuration));
+      assertThat(this.timeUnit.convert(duration, TimeUnit.NANOSECONDS), new TimeMatcher(this.timeUnit, this.minDuration, this.maxDuration));
     }
   }
   
@@ -167,13 +184,13 @@ public class ExpectedTimeoutRule implements TestRule {
     private final Statement next;
 
     public ExpectedTimeoutStatement(final Statement base) {
-      next = base;
+      this.next = base;
     }
 
     @Override
     public void evaluate() throws Throwable {
       long start = System.nanoTime();
-      next.evaluate();
+      this.next.evaluate();
       handleTime(System.nanoTime() - start);
     }
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/RuleList.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/RuleList.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/RuleList.java
index 08446b0..0431083 100755
--- a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/RuleList.java
+++ b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/RuleList.java
@@ -1,92 +1,97 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.test.junit.rules;
-
-import org.junit.rules.TestRule;
-import org.junit.runner.Description;
-import org.junit.runners.model.Statement;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * The {@code RuleList} rule enables ordering of TestRules.
- *
- * <p>Example:
- *
- * <pre>
- * public class SomeTest {
- *
- *   \@Rule
- *   public RuleList rules = new RuleList().add(new FirstRule()
- *                                         .add(new SecondRule()
- *                                         .add(new ThirdRule();
- * </pre>
- *
- * @author Kirk Lund
- */
-public class RuleList implements TestRule {
-  
-  private final List<TestRule> rules = new ArrayList<>();
-
-  /**
-   * Creates an empty {@code RuleList}.
-   */
-  public RuleList() {
-  }
-
-  /**
-   * Creates a {@code RuleList} containing a single {@link TestRule}.
-   *
-   * @param rule the first rule of the {@code RuleList}
-   */
-  public RuleList(final TestRule rule) {
-    this.rules.add(rule);
-  }
-
-  /**
-   * Creates a new {@code RuleList} containing the specified {@link TestRule}s.
-   *
-   * @param rules the list of {@code TestRule}s to add
-   */
-  protected RuleList(final List<TestRule> rules) {
-    this.rules.addAll(rules);
-  }
-
-  /**
-   * Adds a new {@code TestRule} to the end of the current {@code RuleList}.
-   *
-   * @param rule the rule to add.
-   * @return the {@code RuleList} with a new TestRule added
-   */
-  public RuleList add(final TestRule rule) {
-    this.rules.add(rule);
-    return this;
-  }
-
-  @Override
-  public Statement apply(Statement base, final Description description) {
-    for (TestRule each : this.rules) {
-      base = each.apply(base, description);
-    }
-    return base;
-  }
-
-  protected List<TestRule> rules() {
-    return new ArrayList<>(this.rules);
-  }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.rules;
+
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * The {@code RuleList} rule enables ordering of TestRules.
+ *
+ * <p>Example:
+ *
+ * <pre>
+ * public class SomeTest {
+ *
+ *   \@Rule
+ *   public RuleList rules = new RuleList().add(new FirstRule()
+ *                                         .add(new SecondRule()
+ *                                         .add(new ThirdRule();
+ * </pre>
+ *
+ * @author Kirk Lund
+ */
+public class RuleList implements TestRule {
+  
+  private final List<TestRule> rules = new ArrayList<>();
+
+  /**
+   * Creates an empty {@code RuleList}.
+   */
+  public RuleList() {
+  }
+
+  /**
+   * Creates a {@code RuleList} containing a single {@link TestRule}.
+   *
+   * @param rule the first rule of the {@code RuleList}
+   */
+  public RuleList(final TestRule rule) {
+    this.rules.add(rule);
+  }
+
+  /**
+   * Creates a new {@code RuleList} containing the specified {@link TestRule}s.
+   *
+   * @param rules the list of {@code TestRule}s to add
+   */
+  protected RuleList(final List<TestRule> rules) {
+    this.rules.addAll(rules);
+  }
+
+  /**
+   * Adds a new {@code TestRule} to the end of the current {@code RuleList}.
+   *
+   * @param rule the rule to add.
+   * @return the {@code RuleList} with a new TestRule added
+   */
+  public RuleList add(final TestRule rule) {
+    this.rules.add(rule);
+    return this;
+  }
+
+  @Override
+  public Statement apply(Statement base, final Description description) {
+    for (TestRule each : this.rules) {
+      base = each.apply(base, description);
+    }
+    return base;
+  }
+
+  /**
+   * Returns a reference to the actual list of {@code TestRule}s. For use by
+   * subclasses and tests.
+   */
+  protected List<TestRule> rules() {
+    return this.rules;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/TestFixtureRule.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/TestFixtureRule.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/TestFixtureRule.java
index 21e5eb9..7468c1f 100755
--- a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/TestFixtureRule.java
+++ b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/TestFixtureRule.java
@@ -1,151 +1,143 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.test.junit.rules;
-
-import org.junit.rules.TestRule;
-import org.junit.runner.Description;
-import org.junit.runners.model.Statement;
-
-/**
- * An abstract base class for test rules that combine {@code ClassRule} and
- * method {@code Rule} test fixture lifecycle callbacks. Subclasses may
- * override any or all of these methods:
- * <p><ul>
- * <li></li>{@link #beforeClass()}
- * <li></li>{@link #afterClass()}
- * <li></li>{@link #before()}
- * <li></li>{@link #after()}
- * </ul>
- *
- * <p>The rule variable does not have to be static in order to implement
- * {@link #beforeClass()} and {@link #afterClass()}.
- *
- * <p>Example:
- *
- * <pre>
- * public class SomeTest {
- *
- *   \@Rule
- *   public TestFixtureRule testFixtureRule = new TestFixtureRule() {
- *     \@Override
- *     protected void beforeClass() throws Throwable {
- *       // setup executed once before all tests in SomeTest
- *     }
- *     \@Override
- *     protected void afterClass() {
- *       // teardown executed once after all tests in SomeTest
- *     }
- *     \@Override
- *     protected void before() throws Throwable {
- *       // setup executed before each test in SomeTest
- *     }
- *     \@Override
- *     protected void after() {
- *       // teardown executed after each test in SomeTest
- *     }
- *   }
- * }
- * </pre>
- *
- * @author Kirk Lund
- */
-public class TestFixtureRule implements TestRule {
-
-  @Override
-  public Statement apply(final Statement base, final Description description) {
-    if (description.isSuite()) {
-      return createClassStatement(base);
-    } else if (description.isTest()) {
-      return createMethodStatement(base);
-    }
-    return base;
-  }
-
-  /**
-   * Returns new <code>Statement</code> for invoking <code>beforeClass</code>
-   * and <code>afterClass</code>.
-   */
-  protected Statement createClassStatement(final Statement base) {
-    return new Statement() {
-      @Override
-      public void evaluate() throws Throwable {
-        beforeClass();
-        try {
-          base.evaluate();
-        } finally {
-          afterClass();
-        }
-      }
-    };
-  }
-
-  /**
-   * Returns new <code>Statement</code> for invoking <code>before</code>
-   * and <code>after</code>.
-   */
-  protected Statement createMethodStatement(final Statement base) {
-    return new Statement() {
-      @Override
-      public void evaluate() throws Throwable {
-        before();
-        try {
-          base.evaluate();
-        } finally {
-          after();
-        }
-      }
-    };
-  }
-
-  /**
-   * Override to perform custom setup during <code>beforeClass</code> which
-   * is invoked prior to {@link #before()} and all test methods.
-   *
-   * If any <code>Throwable</code> is thrown, then <code>afterClass</code> will
-   * be disabled.
-   *
-   * @throws Throwable if setup fails
-   */
-  protected void beforeClass() throws Throwable {
-  }
-
-  /**
-   * Override to perform custom tearDown during <code>afterClass</code> which
-   * is invoked following {@link #after()} and all test methods.
-   */
-  protected void afterClass() {
-  }
-
-  /**
-   * Override to perform custom setup before each test method.
-   *
-   * If any <code>Throwable</code> is thrown, then <code>after</code> will
-   * be disabled.
-   *
-   * @throws Throwable if setup fails
-   */
-  protected void before() throws Throwable {
-    // do nothing
-  }
-
-  /**
-   * Override to perform custom tearDown during after each test method.
-   */
-  protected void after() {
-    // do nothing
-  }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.rules;
+
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+
+/**
+ * An abstract base class for test rules that combine {@code ClassRule} and
+ * method {@code Rule} test fixture lifecycle callbacks. Subclasses may
+ * override any or all of these methods:
+ * <p><ul>
+ * <li>{@link #beforeClass()}
+ * <li>{@link #afterClass()}
+ * <li>{@link #before()}
+ * <li>{@link #after()}
+ * </ul>
+ *
+ * <p>The rule variable does not have to be static in order to implement
+ * {@link #beforeClass()} and {@link #afterClass()}.
+ *
+ * <p>Example:
+ *
+ * <pre>
+ * public class SomeTest {
+ *
+ *   \@Rule
+ *   public TestFixtureRule testFixtureRule = new TestFixtureRule() {
+ *     \@Override
+ *     protected void beforeClass() throws Throwable {
+ *       // setup executed once before all tests in SomeTest
+ *     }
+ *     \@Override
+ *     protected void afterClass() {
+ *       // teardown executed once after all tests in SomeTest
+ *     }
+ *     \@Override
+ *     protected void before() throws Throwable {
+ *       // setup executed before each test in SomeTest
+ *     }
+ *     \@Override
+ *     protected void after() {
+ *       // teardown executed after each test in SomeTest
+ *     }
+ *   }
+ * }
+ * </pre>
+ */
+public class TestFixtureRule implements TestRule {
+
+  @Override
+  public Statement apply(final Statement base, final Description description) {
+    if (description.isSuite()) {
+      return createClassStatement(base);
+    } else if (description.isTest()) {
+      return createMethodStatement(base);
+    }
+    return base;
+  }
+
+  /**
+   * Returns new <code>Statement</code> for invoking <code>beforeClass</code>
+   * and <code>afterClass</code>.
+   */
+  protected Statement createClassStatement(final Statement base) {
+    return new Statement() {
+      @Override
+      public void evaluate() throws Throwable {
+        beforeClass();
+        try {
+          base.evaluate();
+        } finally {
+          afterClass();
+        }
+      }
+    };
+  }
+
+  /**
+   * Returns new <code>Statement</code> for invoking <code>before</code>
+   * and <code>after</code>.
+   */
+  protected Statement createMethodStatement(final Statement base) {
+    return new Statement() {
+      @Override
+      public void evaluate() throws Throwable {
+        before();
+        try {
+          base.evaluate();
+        } finally {
+          after();
+        }
+      }
+    };
+  }
+
+  /**
+   * Override to perform custom setup during <code>beforeClass</code> which
+   * is invoked prior to {@link #before()} and all test methods.
+   *
+   * @throws Throwable if setup fails
+   */
+  protected void beforeClass() throws Throwable {
+  }
+
+  /**
+   * Override to perform custom tearDown during <code>afterClass</code> which
+   * is invoked following {@link #after()} and all test methods.
+   */
+  protected void afterClass() {
+  }
+
+  /**
+   * Override to perform custom setup before each test method.
+   *
+   * @throws Throwable if setup fails
+   */
+  protected void before() throws Throwable {
+    // do nothing
+  }
+
+  /**
+   * Override to perform custom tearDown during after each test method.
+   */
+  protected void after() {
+    // do nothing
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/FieldsOfTestName.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/FieldsOfTestName.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/FieldsOfTestName.java
index 3a2e4bb..f30ed10 100755
--- a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/FieldsOfTestName.java
+++ b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/FieldsOfTestName.java
@@ -19,6 +19,6 @@ package com.gemstone.gemfire.test.junit.rules.serializable;
 /**
  * Names of member fields in {@link org.junit.rules.TestName}.
  */
-public interface FieldsOfTestName {
+interface FieldsOfTestName {
   static final String FIELD_NAME = "name"; // String
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableRuleList.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableRuleList.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableRuleList.java
index b1bbf83..3ae3079 100755
--- a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableRuleList.java
+++ b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableRuleList.java
@@ -37,7 +37,7 @@ public class SerializableRuleList extends RuleList implements SerializableTestRu
     super(rule);
   }
 
-  public SerializableRuleList(final List<TestRule> rules) {
+  protected SerializableRuleList(final List<TestRule> rules) {
     super(rules);
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTemporaryFolder.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTemporaryFolder.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTemporaryFolder.java
index 6fb01cd..390cdc7 100755
--- a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTemporaryFolder.java
+++ b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTemporaryFolder.java
@@ -53,7 +53,6 @@ public class SerializableTemporaryFolder extends TemporaryFolder implements Seri
    */
   private static class SerializationProxy implements Serializable {
 
-    private static final long serialVersionUID = 1905526044015078240L;
     private final File parentFolder;
     private final File folder;
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestRule.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestRule.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestRule.java
index f910c14..9d06bc6 100755
--- a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestRule.java
+++ b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestRule.java
@@ -23,9 +23,6 @@ import org.junit.rules.TestRule;
 /**
  * Specifies that a {@link org.junit.rules.TestRule TestRule} is
  * {@code Serializable}.
- *
- * The simplest way to satisfy this interface is to apply {@code transient} to
- * every instance field.
  */
 public interface SerializableTestRule extends Serializable, TestRule {
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestWatcher.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestWatcher.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestWatcher.java
index 6292d7c..d325b09 100755
--- a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestWatcher.java
+++ b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestWatcher.java
@@ -19,8 +19,8 @@ package com.gemstone.gemfire.test.junit.rules.serializable;
 import org.junit.rules.TestWatcher;
 
 /**
- * Serializable subclass of {@link org.junit.rules.TestWatcher TestWatcher}. No
- * instance variables are serialized.
+ * Serializable subclass of {@link org.junit.rules.TestWatcher TestWatcher}.
+ * There are no instance variables to be serialized.
  */
 public abstract class SerializableTestWatcher extends TestWatcher implements SerializableTestRule {
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTimeout.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTimeout.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTimeout.java
index e77120d..f3a4ba7 100755
--- a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTimeout.java
+++ b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTimeout.java
@@ -36,14 +36,10 @@ public class SerializableTimeout extends Timeout implements SerializableTestRule
     return new Builder();
   }
 
-  public SerializableTimeout() {
-    this(builder());
-  }
-
   public SerializableTimeout(final long timeout, final TimeUnit timeUnit) {
     super(timeout, timeUnit);
   }
-  
+
   protected SerializableTimeout(final Builder builder) {
     super(builder);
   }
@@ -72,11 +68,11 @@ public class SerializableTimeout extends Timeout implements SerializableTestRule
     }
 
     @Override
-    public Builder withLookingForStuckThread(boolean enable) {
+    public Builder withLookingForStuckThread(final boolean enable) {
       super.withLookingForStuckThread(enable);
       return this;
     }
-    
+
     @Override
     public SerializableTimeout build() {
       return new SerializableTimeout(this);
@@ -92,7 +88,7 @@ public class SerializableTimeout extends Timeout implements SerializableTestRule
     private final TimeUnit timeUnit;
     private final boolean lookForStuckThread;
 
-    SerializationProxy(SerializableTimeout instance) {
+    SerializationProxy(final SerializableTimeout instance) {
       this.timeout = (long) readField(Timeout.class, instance, FIELD_TIMEOUT);
       this.timeUnit =(TimeUnit) readField(Timeout.class, instance, FIELD_TIME_UNIT);
       this.lookForStuckThread =(boolean) readField(Timeout.class, instance, FIELD_LOOK_FOR_STUCK_THREAD);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/support/DefaultIgnoreCondition.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/support/DefaultIgnoreCondition.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/support/DefaultIgnoreCondition.java
index b721c41..67177d2 100755
--- a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/support/DefaultIgnoreCondition.java
+++ b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/support/DefaultIgnoreCondition.java
@@ -46,7 +46,7 @@ public class DefaultIgnoreCondition implements IgnoreCondition {
   }
 
   public boolean isIgnore() {
-    return ignore;
+    return this.ignore;
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/ExpectedTimeoutRuleTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/ExpectedTimeoutRuleTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/ExpectedTimeoutRuleTest.java
index f2191f0..5a0d45c 100755
--- a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/ExpectedTimeoutRuleTest.java
+++ b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/ExpectedTimeoutRuleTest.java
@@ -123,29 +123,46 @@ public class ExpectedTimeoutRuleTest {
     Failure failure = failures.get(0);
     assertThat(failure.getException()).isExactlyInstanceOf(AssertionError.class).hasMessage("Expected test to throw (an instance of " + TimeoutException.class.getName() + " and exception with message a string containing \"" + FailsWhenTimeoutIsLate.message + "\")");
   }
-  
+
+  /**
+   * Base class for all inner class test cases
+   */
   public static class AbstractExpectedTimeoutRuleTest {
+
     @Rule
     public ExpectedTimeoutRule timeout = ExpectedTimeoutRule.none();
   }
-  
+
+  /**
+   * Used by test {@link #passesUnused()}
+   */
   public static class PassingTestShouldPassWhenUnused extends AbstractExpectedTimeoutRuleTest {
+
     @Test
-    public void passesUnused() throws Exception {
+    public void doTest() {
     }
   }
-  
+
+  /**
+   * Used by test {@link #failsWithoutExpectedException()}
+   */
   public static class FailsWithoutExpectedException extends AbstractExpectedTimeoutRuleTest {
+
     @Test
-    public void failsWithoutExpectedException() throws Exception {
+    public void doTest() {
       timeout.expect(TimeoutException.class);
     }
   }
-  
+
+  /**
+   * Used by test {@link #failsWithoutExpectedTimeoutException()}
+   */
   public static class FailsWithoutExpectedTimeoutException extends AbstractExpectedTimeoutRuleTest {
-    public static final String message = "this is a message for FailsWithoutExpectedTimeoutException";
+
+    static final String message = "this is a message for FailsWithoutExpectedTimeoutException";
+
     @Test
-    public void failsWithoutExpectedTimeoutAndTimeoutException() throws Exception {
+    public void doTest() throws Exception {
       timeout.expect(TimeoutException.class);
       timeout.expectMessage(message);
       timeout.expectMinimumDuration(10);
@@ -154,11 +171,16 @@ public class ExpectedTimeoutRuleTest {
       Thread.sleep(100);
     }
   }
-  
+
+  /**
+   * Used by test {@link #failsWithExpectedTimeoutButWrongError()}
+   */
   public static class FailsWithExpectedTimeoutButWrongError extends AbstractExpectedTimeoutRuleTest {
-    public static final String message = "this is a message for FailsWithExpectedTimeoutButWrongError";
+
+    static final String message = "this is a message for FailsWithExpectedTimeoutButWrongError";
+
     @Test
-    public void failsWithExpectedTimeoutButWrongError() throws Exception {
+    public void doTest() throws Exception {
       timeout.expect(TimeoutException.class);
       timeout.expectMessage(message);
       timeout.expectMinimumDuration(10);
@@ -169,11 +191,16 @@ public class ExpectedTimeoutRuleTest {
     }
   }
 
+  /**
+   * Used by test {@link #passesWithExpectedTimeoutAndTimeoutException()}
+   */
   public static class PassesWithExpectedTimeoutAndTimeoutException extends AbstractExpectedTimeoutRuleTest {
-    public static final String message = "this is a message for PassesWithExpectedTimeoutAndTimeoutException";
-    public static final Class<TimeoutException> exceptionClass = TimeoutException.class;
+
+    static final String message = "this is a message for PassesWithExpectedTimeoutAndTimeoutException";
+    static final Class<TimeoutException> exceptionClass = TimeoutException.class;
+
     @Test
-    public void passesWithExpectedTimeoutAndTimeoutException() throws Exception {
+    public void doTest() throws Exception {
       timeout.expect(exceptionClass);
       timeout.expectMessage(message);
       timeout.expectMinimumDuration(10);
@@ -184,10 +211,15 @@ public class ExpectedTimeoutRuleTest {
     }
   }
 
+  /**
+   * Used by test {@link #failsWhenTimeoutIsEarly()}
+   */
   public static class FailsWhenTimeoutIsEarly extends AbstractExpectedTimeoutRuleTest {
-    public static final String message = "this is a message for FailsWhenTimeoutIsEarly";
+
+    static final String message = "this is a message for FailsWhenTimeoutIsEarly";
+
     @Test
-    public void failsWhenTimeoutIsEarly() throws Exception {
+    public void doTest() throws Exception {
       timeout.expect(TimeoutException.class);
       timeout.expectMessage(message);
       timeout.expectMinimumDuration(1000);
@@ -197,10 +229,15 @@ public class ExpectedTimeoutRuleTest {
     }
   }
 
+  /**
+   * Used by test {@link #failsWhenTimeoutIsLate()}
+   */
   public static class FailsWhenTimeoutIsLate extends AbstractExpectedTimeoutRuleTest {
-    public static final String message = "this is a message for FailsWhenTimeoutIsLate";
+
+    static final String message = "this is a message for FailsWhenTimeoutIsLate";
+
     @Test
-    public void failsWhenTimeoutIsLate() throws Exception {
+    public void doTest() throws Exception {
       timeout.expect(TimeoutException.class);
       timeout.expectMessage(message);
       timeout.expectMinimumDuration(10);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/IgnoreUntilRuleTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/IgnoreUntilRuleTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/IgnoreUntilRuleTest.java
index 568bec5..9d99971 100755
--- a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/IgnoreUntilRuleTest.java
+++ b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/IgnoreUntilRuleTest.java
@@ -20,6 +20,7 @@ import static org.assertj.core.api.Assertions.*;
 
 import java.util.List;
 
+import org.junit.BeforeClass;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -74,13 +75,22 @@ public class IgnoreUntilRuleTest {
     assertThat(failure.getException()).isExactlyInstanceOf(AssertionError.class).hasMessage(ASSERTION_ERROR_MESSAGE);
     assertThat(ShouldExecuteWhenUntilIsDefault.count).isEqualTo(1);
   }
-  
+
+  /**
+   * Used by test {@link #shouldIgnoreWhenUntilIsInFuture()}
+   */
   public static class ShouldIgnoreWhenUntilIsInFuture {
-    private static int count;
-    
+
+    static int count = 0;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+    }
+
     @Rule
     public final IgnoreUntilRule ignoreUntilRule = new IgnoreUntilRule();
-    
+
     @Test
     @IgnoreUntil(value = "description", until = "3000-01-01")
     public void doTest() throws Exception {
@@ -89,12 +99,21 @@ public class IgnoreUntilRuleTest {
     }
   }
 
+  /**
+   * Used by test {@link #shouldExecuteWhenUntilIsInPast()}
+   */
   public static class ShouldExecuteWhenUntilIsInPast {
-    private static int count;
-    
+
+    static int count = 0;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+    }
+
     @Rule
     public final IgnoreUntilRule ignoreUntilRule = new IgnoreUntilRule();
-    
+
     @Test
     @IgnoreUntil(value = "description", until = "1980-01-01")
     public void doTest() throws Exception {
@@ -103,14 +122,23 @@ public class IgnoreUntilRuleTest {
     }
   }
 
+  /**
+   * Used by test {@link #shouldExecuteWhenUntilIsDefault()}
+   */
   public static class ShouldExecuteWhenUntilIsDefault {
-    private static int count;
-    
+
+    static int count = 0;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+    }
+
     @Rule
     public final IgnoreUntilRule ignoreUntilRule = new IgnoreUntilRule();
-    
+
     @Test
-    @IgnoreUntil(value = "description")
+    @IgnoreUntil("description")
     public void doTest() throws Exception {
       count++;
       fail(ASSERTION_ERROR_MESSAGE);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RepeatRuleTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RepeatRuleTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RepeatRuleTest.java
index e17bc51..e22a87a 100755
--- a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RepeatRuleTest.java
+++ b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RepeatRuleTest.java
@@ -20,6 +20,7 @@ import static org.assertj.core.api.Assertions.*;
 
 import java.util.List;
 
+import org.junit.BeforeClass;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -89,6 +90,17 @@ public class RepeatRuleTest {
     assertThat(NegativeValueShouldThrowIllegalArgumentException.count).isEqualTo(0);
   }
 
+  /**
+   * Characterizes the behavior but is not a requirement for {@code RepeatRule}.
+   */
+  @Test
+  public void passingTestShouldBeSkippedWhenRepeatIsZero() {
+    Result result = TestRunner.runTest(PassingTestShouldBeSkippedWhenRepeatIsZero.class);
+
+    assertThat(result.wasSuccessful()).isFalse();
+    assertThat(PassingTestShouldBeSkippedWhenRepeatIsZero.count).isEqualTo(0);
+  }
+
   @Test
   public void failingTestShouldFailOneTimeWhenRepeatIsOne() {
     Result result = TestRunner.runTest(FailingTestShouldFailOneTimeWhenRepeatIsOne.class);
@@ -155,9 +167,18 @@ public class RepeatRuleTest {
     assertThat(PassingTestShouldPassThreeTimesWhenRepeatIsThree.count).isEqualTo(3);
   }
 
+  /**
+   * Used by test {@link #failingTestShouldFailOneTimeWhenRepeatIsUnused()}
+   */
   public static class FailingTestShouldFailOneTimeWhenRepeatIsUnused {
-    protected static int count = 0;
-    
+
+    static int count = 0;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+    }
+
     @Rule
     public RepeatRule repeat = new RepeatRule();
 
@@ -168,9 +189,18 @@ public class RepeatRuleTest {
     }
   }
 
+  /**
+   * Used by test {@link #passingTestShouldPassOneTimeWhenRepeatIsUnused()}
+   */
   public static class PassingTestShouldPassOneTimeWhenRepeatIsUnused {
-    protected static int count = 0;
-    
+
+    static int count = 0;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+    }
+
     @Rule
     public RepeatRule repeat = new RepeatRule();
 
@@ -180,9 +210,18 @@ public class RepeatRuleTest {
     }
   }
 
+  /**
+   * Used by test {@link #zeroValueShouldThrowIllegalArgumentException()}
+   */
   public static class ZeroValueShouldThrowIllegalArgumentException {
-    protected static int count = 0;
-    
+
+    static int count = 0;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+    }
+
     @Rule
     public RepeatRule repeat = new RepeatRule();
 
@@ -193,9 +232,18 @@ public class RepeatRuleTest {
     }
   }
 
+  /**
+   * Used by test {@link #negativeValueShouldThrowIllegalArgumentException()}
+   */
   public static class NegativeValueShouldThrowIllegalArgumentException {
-    protected static int count = 0;
-    
+
+    static int count = 0;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+    }
+
     @Rule
     public RepeatRule repeat = new RepeatRule();
 
@@ -206,9 +254,18 @@ public class RepeatRuleTest {
     }
   }
 
+  /**
+   * Used by test {@link #passingTestShouldBeSkippedWhenRepeatIsZero()}
+   */
   public static class PassingTestShouldBeSkippedWhenRepeatIsZero {
-    protected static int count = 0;
-    
+
+    static int count = 0;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+    }
+
     @Rule
     public RepeatRule repeat = new RepeatRule();
 
@@ -218,10 +275,19 @@ public class RepeatRuleTest {
       count++;
     }
   }
-  
+
+  /**
+   * Used by test {@link #failingTestShouldFailOneTimeWhenRepeatIsOne()}
+   */
   public static class FailingTestShouldFailOneTimeWhenRepeatIsOne {
-    protected static int count = 0;
-    
+
+    static int count = 0;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+    }
+
     @Rule
     public RepeatRule repeat = new RepeatRule();
 
@@ -233,9 +299,18 @@ public class RepeatRuleTest {
     }
   }
 
+  /**
+   * Used by test {@link #passingTestShouldPassOneTimeWhenRepeatIsOne()}
+   */
   public static class PassingTestShouldPassOneTimeWhenRepeatIsOne {
-    protected static int count = 0;
-    
+
+    static int count = 0;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+    }
+
     @Rule
     public RepeatRule repeat = new RepeatRule();
 
@@ -246,9 +321,18 @@ public class RepeatRuleTest {
     }
   }
 
+  /**
+   * Used by test {@link #failingTestShouldFailOneTimeWhenRepeatIsTwo()}
+   */
   public static class FailingTestShouldFailOneTimeWhenRepeatIsTwo {
-    protected static int count = 0;
-    
+
+    static int count = 0;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+    }
+
     @Rule
     public RepeatRule repeat = new RepeatRule();
 
@@ -260,9 +344,18 @@ public class RepeatRuleTest {
     }
   }
 
+  /**
+   * Used by test {@link #passingTestShouldPassTwoTimesWhenRepeatIsTwo()}
+   */
   public static class PassingTestShouldPassTwoTimesWhenRepeatIsTwo {
-    protected static int count = 0;
-    
+
+    static int count = 0;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+    }
+
     @Rule
     public RepeatRule repeat = new RepeatRule();
 
@@ -273,9 +366,18 @@ public class RepeatRuleTest {
     }
   }
 
+  /**
+   * Used by test {@link #failingTestShouldFailOneTimeWhenRepeatIsThree()}
+   */
   public static class FailingTestShouldFailOneTimeWhenRepeatIsThree {
-    protected static int count = 0;
-    
+
+    static int count = 0;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+    }
+
     @Rule
     public RepeatRule repeat = new RepeatRule();
 
@@ -287,9 +389,18 @@ public class RepeatRuleTest {
     }
   }
 
+  /**
+   * Used by test {@link #passingTestShouldPassThreeTimesWhenRepeatIsThree()}
+   */
   public static class PassingTestShouldPassThreeTimesWhenRepeatIsThree {
-    protected static int count = 0;
-    
+
+    static int count = 0;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+    }
+
     @Rule
     public RepeatRule repeat = new RepeatRule();
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RetryRuleGlobalWithErrorTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RetryRuleGlobalWithErrorTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RetryRuleGlobalWithErrorTest.java
index ee51c4e..75d5a60 100755
--- a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RetryRuleGlobalWithErrorTest.java
+++ b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RetryRuleGlobalWithErrorTest.java
@@ -21,6 +21,7 @@ import static org.junit.Assert.fail;
 
 import java.util.List;
 
+import org.junit.BeforeClass;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -127,85 +128,142 @@ public class RetryRuleGlobalWithErrorTest {
     assertThat(result.wasSuccessful()).isTrue();
     assertThat(PassesOnThirdAttempt.count).isEqualTo(3);
   }
-  
+
+  /**
+   * Used by test {@link #zeroIsIllegal()}
+   */
   public static class ZeroIsIllegal {
-    protected static int count;
-    protected static final String message = "Retry count must be greater than zero";
+
+    static final String message = "Retry count must be greater than zero";
+    static int count = 0;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+    }
 
     @Rule
     public RetryRule retryRule = new RetryRule(0);
 
     @Test
-    public void zeroIsIllegal() throws Exception {
+    public void doTest() throws Exception {
       count++;
     }
   }
-  
+
+  /**
+   * Used by test {@link #failsWithOne()}
+   */
   public static class FailsWithOne {
-    protected static int count;
-    protected static String message;
+
+    static int count = 0;
+    static String message = null;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+      message = null;
+    }
 
     @Rule
     public RetryRule retryRule = new RetryRule(1);
 
     @Test
-    public void failsWithOne() throws Exception {
+    public void doTest() throws Exception {
       count++;
       message = "Failing " + count;
       fail(message);
     }
   }
-  
+
+  /**
+   * Used by test {@link #passesWithOne()}
+   */
   public static class PassesWithOne {
-    protected static int count;
+
+    static int count = 0;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+    }
 
     @Rule
     public RetryRule retryRule = new RetryRule(1);
 
     @Test
-    public void passesWithOne() throws Exception {
+    public void doTest() throws Exception {
       count++;
     }
   }
-  
+
+  /**
+   * Used by test {@link #passesWithUnused()}
+   */
   public static class PassesWhenUnused {
-    protected static int count;
+
+    static int count = 0;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+    }
 
     @Rule
     public RetryRule retryRule = new RetryRule(2);
 
     @Test
-    public void passesWithUnused() throws Exception {
+    public void doTest() throws Exception {
       count++;
     }
   }
-  
+
+  /**
+   * Used by test {@link #failsOnSecondAttempt()}
+   */
   public static class FailsOnSecondAttempt {
-    protected static int count;
-    protected static String message;
+
+    static int count = 0;
+    static String message = null;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+      message = null;
+    }
 
     @Rule
     public RetryRule retryRule = new RetryRule(2);
 
     @Test
     @Retry(2)
-    public void failsOnSecondAttempt() {
+    public void doTest() throws Exception {
       count++;
       message = "Failing " + count;
       fail(message);
     }
   }
-  
+
+  /**
+   * Used by test {@link #passesOnSecondAttempt()}
+   */
   public static class PassesOnSecondAttempt {
-    protected static int count;
-    protected static String message;
-    
+
+    static int count = 0;
+    static String message = null;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+      message = null;
+    }
+
     @Rule
     public RetryRule retryRule = new RetryRule(2);
 
     @Test
     @Retry(2)
-    public void failsOnSecondAttempt() {
+    public void doTest() throws Exception {
       count++;
       if (count < 2) {
         message = "Failing " + count;
@@ -213,32 +271,52 @@ public class RetryRuleGlobalWithErrorTest {
       }
     }
   }
-  
+
+  /**
+   * Used by test {@link #failsOnThirdAttempt()}
+   */
   public static class FailsOnThirdAttempt {
-    protected static int count;
-    protected static String message;
+
+    static int count = 0;
+    static String message = null;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+      message = null;
+    }
 
     @Rule
     public RetryRule retryRule = new RetryRule(3);
 
     @Test
     @Retry(3)
-    public void failsOnThirdAttempt() {
+    public void doTest() throws Exception {
       count++;
       message = "Failing " + count;
       fail(message);
     }
   }
 
+  /**
+   * Used by test {@link #passesOnThirdAttempt()}
+   */
   public static class PassesOnThirdAttempt {
-    protected static int count;
-    protected static String message;
+
+    static int count = 0;
+    static String message = null;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+      message = null;
+    }
 
     @Rule
     public RetryRule retryRule = new RetryRule(3);
 
     @Test
-    public void failsOnThirdAttempt() {
+    public void doTest() throws Exception {
       count++;
       if (count < 3) {
         message = "Failing " + count;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RetryRuleGlobalWithExceptionTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RetryRuleGlobalWithExceptionTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RetryRuleGlobalWithExceptionTest.java
index 4afa2c2..b060820 100755
--- a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RetryRuleGlobalWithExceptionTest.java
+++ b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RetryRuleGlobalWithExceptionTest.java
@@ -20,6 +20,7 @@ import static org.assertj.core.api.Assertions.*;
 
 import java.util.List;
 
+import org.junit.BeforeClass;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -124,92 +125,151 @@ public class RetryRuleGlobalWithExceptionTest {
     assertThat(result.wasSuccessful()).isTrue();
     assertThat(PassesOnThirdAttempt.count).isEqualTo(3);
   }
-  
+
+  /**
+   * Custom exception used by several tests
+   */
   public static class CustomException extends Exception {
-    private static final long serialVersionUID = 1L;
     public CustomException(final String message) {
       super(message);
     }
   }
-  
+
+  /**
+   * Used by test {@link #zeroIsIllegal()}
+   */
   public static class ZeroIsIllegal {
-    protected static int count;
-    protected static final String message = "Retry count must be greater than zero";
+
+    static int count = 0;
+    static final String message = "Retry count must be greater than zero";
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+    }
 
     @Rule
     public RetryRule retryRule = new RetryRule(0);
 
     @Test
-    public void zeroIsIllegal() throws Exception {
+    public void doTest() throws Exception {
       count++;
     }
   }
-  
+
+  /**
+   * Used by test {@link #failsWithOne()}
+   */
   public static class FailsWithOne {
-    protected static int count;
-    protected static String message;
+
+    static int count = 0;
+    static String message = null;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+      message = null;
+    }
 
     @Rule
     public RetryRule retryRule = new RetryRule(1);
 
     @Test
-    public void failsWithOne() throws Exception {
+    public void doTest() throws Exception {
       count++;
       message = "Failing " + count;
       throw new CustomException(message);
     }
   }
-  
+
+  /**
+   * Used by test {@link #passesWithOne()}
+   */
   public static class PassesWithOne {
-    protected static int count;
+
+    static int count = 0;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+    }
 
     @Rule
     public RetryRule retryRule = new RetryRule(1);
 
     @Test
-    public void passesWithOne() throws Exception {
+    public void doTest() throws Exception {
       count++;
     }
   }
-  
+
+  /**
+   * Used by test {@link #passesWithUnused()}
+   */
   public static class PassesWhenUnused {
-    protected static int count;
+
+    static int count = 0;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+    }
 
     @Rule
     public RetryRule retryRule = new RetryRule(2);
 
     @Test
-    public void passesWithUnused() throws Exception {
+    public void doTest() throws Exception {
       count++;
     }
   }
-  
+
+  /**
+   * Used by test {@link #failsOnSecondAttempt()}
+   */
   public static class FailsOnSecondAttempt {
-    protected static int count;
-    protected static String message;
+
+    static int count = 0;
+    static String message = null;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+      message = null;
+    }
 
     @Rule
     public RetryRule retryRule = new RetryRule(2);
 
     @Test
     @Retry(2)
-    public void failsOnSecondAttempt() throws Exception {
+    public void doTest() throws Exception {
       count++;
       message = "Failing " + count;
       throw new CustomException(message);
     }
   }
-  
+
+  /**
+   * Used by test {@link #passesOnSecondAttempt()}
+   */
   public static class PassesOnSecondAttempt {
-    protected static int count;
-    protected static String message;
+
+    static int count = 0;
+    static String message = null;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+      message = null;
+    }
     
     @Rule
     public RetryRule retryRule = new RetryRule(2);
 
     @Test
     @Retry(2)
-    public void failsOnSecondAttempt() throws Exception {
+    public void doTest() throws Exception {
       count++;
       if (count < 2) {
         message = "Failing " + count;
@@ -217,32 +277,52 @@ public class RetryRuleGlobalWithExceptionTest {
       }
     }
   }
-  
+
+  /**
+   * Used by test {@link #failsOnThirdAttempt()}
+   */
   public static class FailsOnThirdAttempt {
-    protected static int count;
-    protected static String message;
+
+    static int count = 0;
+    static String message = null;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+      message = null;
+    }
 
     @Rule
     public RetryRule retryRule = new RetryRule(3);
 
     @Test
     @Retry(3)
-    public void failsOnThirdAttempt() throws Exception {
+    public void doTest() throws Exception {
       count++;
       message = "Failing " + count;
       throw new CustomException(message);
     }
   }
 
+  /**
+   * Used by test {@link #passesOnThirdAttempt()}
+   */
   public static class PassesOnThirdAttempt {
-    protected static int count;
-    protected static String message;
+
+    static int count = 0;
+    static String message = null;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+      message = null;
+    }
 
     @Rule
     public RetryRule retryRule = new RetryRule(3);
 
     @Test
-    public void failsOnThirdAttempt() throws Exception {
+    public void doTest() throws Exception {
       count++;
       if (count < 3) {
         message = "Failing " + count;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RetryRuleLocalWithErrorTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RetryRuleLocalWithErrorTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RetryRuleLocalWithErrorTest.java
index ad3c258..a57462e 100755
--- a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RetryRuleLocalWithErrorTest.java
+++ b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RetryRuleLocalWithErrorTest.java
@@ -21,6 +21,7 @@ import static org.junit.Assert.fail;
 
 import java.util.List;
 
+import org.junit.BeforeClass;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -105,61 +106,101 @@ public class RetryRuleLocalWithErrorTest {
     assertThat(result.wasSuccessful()).isTrue();
     assertThat(PassesOnThirdAttempt.count).isEqualTo(3);
   }
-  
+
+  /**
+   * Used by test {@link #failsUnused()}
+   */
   public static class FailsUnused {
-    protected static int count;
-    protected static String message;
+
+    static int count = 0;
+    static String message = null;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+      message = null;
+    }
 
     @Rule
     public RetryRule retryRule = new RetryRule();
 
     @Test
-    public void failsUnused() throws Exception {
+    public void doTest() throws Exception {
       count++;
       message = "Failing " + count;
       fail(message);
     }
   }
-  
+
+  /**
+   * Used by test {@link #passesUnused()}
+   */
   public static class PassesUnused {
-    protected static int count;
-    protected static String message;
+
+    static int count = 0;
+    static String message = null;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+      message = null;
+    }
 
     @Rule
     public RetryRule retryRule = new RetryRule();
 
     @Test
-    public void passesUnused() throws Exception {
+    public void doTest() throws Exception {
       count++;
     }
   }
-  
+
+  /**
+   * Used by test {@link #failsOnSecondAttempt()}
+   */
   public static class FailsOnSecondAttempt {
-    protected static int count;
-    protected static String message;
-    
+
+    static int count = 0;
+    static String message = null;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+      message = null;
+    }
+
     @Rule
     public RetryRule retryRule = new RetryRule();
 
     @Test
     @Retry(2)
-    public void failsOnSecondAttempt() {
+    public void doTest() throws Exception {
       count++;
       message = "Failing " + count;
       fail(message);
     }
   }
-  
+
+  /**
+   * Used by test {@link #passesOnSecondAttempt()}
+   */
   public static class PassesOnSecondAttempt {
-    protected static int count;
-    protected static String message;
-    
+
+    static int count = 0;
+    static String message = null;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+      message = null;
+    }
+
     @Rule
     public RetryRule retryRule = new RetryRule();
 
     @Test
     @Retry(2)
-    public void failsOnSecondAttempt() {
+    public void doTest() throws Exception {
       count++;
       if (count < 2) {
         message = "Failing " + count;
@@ -167,17 +208,27 @@ public class RetryRuleLocalWithErrorTest {
       }
     }
   }
-  
+
+  /**
+   * Used by test {@link #failsOnThirdAttempt()}
+   */
   public static class FailsOnThirdAttempt {
-    protected static int count;
-    protected static String message;
-    
+
+    static int count = 0;
+    static String message = null;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+      message = null;
+    }
+
     @Rule
     public RetryRule retryRule = new RetryRule();
 
     @Test
     @Retry(3)
-    public void failsOnThirdAttempt() {
+    public void doTest() throws Exception {
       count++;
 
       message = "Failing " + count;
@@ -185,16 +236,26 @@ public class RetryRuleLocalWithErrorTest {
     }
   }
 
+  /**
+   * Used by test {@link #passesOnThirdAttempt()}
+   */
   public static class PassesOnThirdAttempt {
-    protected static int count;
-    protected static String message;
-    
+
+    static int count = 0;
+    static String message = null;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+      message = null;
+    }
+
     @Rule
     public RetryRule retryRule = new RetryRule();
 
     @Test
     @Retry(3)
-    public void failsOnThirdAttempt() {
+    public void doTest() throws Exception {
       count++;
 
       if (count < 3) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RetryRuleLocalWithExceptionTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RetryRuleLocalWithExceptionTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RetryRuleLocalWithExceptionTest.java
index 00363dd..48e34d2 100755
--- a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RetryRuleLocalWithExceptionTest.java
+++ b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RetryRuleLocalWithExceptionTest.java
@@ -20,6 +20,7 @@ import static org.assertj.core.api.Assertions.*;
 
 import java.util.List;
 
+import org.junit.BeforeClass;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -106,68 +107,110 @@ public class RetryRuleLocalWithExceptionTest {
     assertThat(result.wasSuccessful()).isTrue();
     assertThat(PassesOnThirdAttempt.count).isEqualTo(3);
   }
-  
+
+  /**
+   * Custom exception used by several tests
+   */
   public static class CustomException extends Exception {
-    private static final long serialVersionUID = 1L;
     public CustomException(final String message) {
       super(message);
     }
   }
-  
+
+  /**
+   * Used by test {@link #failsUnused()}
+   */
   public static class FailsUnused {
-    protected static int count;
-    protected static String message;
+
+    static int count = 0;
+    static String message = null;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+      message = null;
+    }
 
     @Rule
     public RetryRule retryRule = new RetryRule();
 
     @Test
-    public void failsUnused() throws Exception {
+    public void doTest() throws Exception {
       count++;
       message = "Failing " + count;
       throw new CustomException(message);
     }
   }
-  
+
+  /**
+   * Used by test {@link #passesUnused()}
+   */
   public static class PassesUnused {
-    protected static int count;
-    protected static String message;
+
+    static int count = 0;
+    static String message = null;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+      message = null;
+    }
 
     @Rule
     public RetryRule retryRule = new RetryRule();
 
     @Test
-    public void passesUnused() throws Exception {
+    public void doTest() throws Exception {
       count++;
     }
   }
-  
+
+  /**
+   * Used by test {@link #failsOnSecondAttempt()}
+   */
   public static class FailsOnSecondAttempt {
-    protected static int count;
-    protected static String message;
-    
+
+    static int count = 0;
+    static String message = null;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+      message = null;
+    }
+
     @Rule
     public RetryRule retryRule = new RetryRule();
 
     @Test
     @Retry(2)
-    public void failsOnSecondAttempt() throws Exception {
+    public void doTest() throws Exception {
       count++;
       message = "Failing " + count;
       throw new CustomException(message);
     }
   }
-  
+
+  /**
+   * Used by test {@link #passesOnSecondAttempt()}
+   */
   public static class PassesOnSecondAttempt {
-    protected static int count;
-    protected static String message;
-    
+
+    static int count = 0;
+    static String message = null;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+      message = null;
+    }
+
     @Rule
     public RetryRule retryRule = new RetryRule();
 
     @Test
     @Retry(2)
-    public void failsOnSecondAttempt() throws Exception {
+    public void doTest() throws Exception {
       count++;
       if (count < 2) {
         message = "Failing " + count;
@@ -175,17 +218,27 @@ public class RetryRuleLocalWithExceptionTest {
       }
     }
   }
-  
+
+  /**
+   * Used by test {@link #failsOnThirdAttempt()}
+   */
   public static class FailsOnThirdAttempt {
-    protected static int count;
-    protected static String message;
-    
+
+    static int count = 0;
+    static String message = null;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+      message = null;
+    }
+
     @Rule
     public RetryRule retryRule = new RetryRule();
 
     @Test
     @Retry(3)
-    public void failsOnThirdAttempt() throws Exception {
+    public void doTest() throws Exception {
       count++;
 
       message = "Failing " + count;
@@ -193,16 +246,26 @@ public class RetryRuleLocalWithExceptionTest {
     }
   }
 
+  /**
+   * Used by test {@link #passesOnThirdAttempt()}
+   */
   public static class PassesOnThirdAttempt {
-    protected static int count;
-    protected static String message;
+
+    static int count = 0;
+    static String message = null;
+
+    @BeforeClass
+    public static void beforeClass() {
+      count = 0;
+      message = null;
+    }
     
     @Rule
     public RetryRule retryRule = new RetryRule();
 
     @Test
     @Retry(3)
-    public void failsOnThirdAttempt() throws Exception {
+    public void doTest() throws Exception {
       count++;
 
       if (count < 3) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7aba9ae0/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RuleListTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RuleListTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RuleListTest.java
new file mode 100755
index 0000000..0ae23f1
--- /dev/null
+++ b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RuleListTest.java
@@ -0,0 +1,215 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.rules;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExternalResource;
+import org.junit.runner.Result;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * Unit tests for {@link RuleList}.
+ */
+public class RuleListTest {
+
+  private static AtomicInteger counter;
+  private static Invocations[] invocations;
+
+  @BeforeClass
+  public static void setUpClass() {
+    counter = new AtomicInteger();
+    invocations = new Invocations[] { new Invocations(counter), new Invocations(counter), new Invocations(counter) };
+  }
+
+  @AfterClass
+  public static void tearDownClass() {
+    counter = null;
+    invocations = null;
+    ThreeRules.ruleListStatic = null;
+  }
+
+  @Test
+  public void firstShouldBeFirstBeforeLastAfter() {
+    Result result = TestRunner.runTest(ThreeRules.class);
+
+    assertThat(result.wasSuccessful()).isTrue();
+
+    assertThat(counter.get()).isEqualTo(9);
+
+    assertThat(invocations[0].beforeInvocation).isEqualTo(1);
+    assertThat(invocations[1].beforeInvocation).isEqualTo(2);
+    assertThat(invocations[2].beforeInvocation).isEqualTo(3);
+
+    assertThat(invocations[0].testInvocation).isEqualTo(4);
+    assertThat(invocations[1].testInvocation).isEqualTo(5);
+    assertThat(invocations[2].testInvocation).isEqualTo(6);
+
+    assertThat(invocations[2].afterInvocation).isEqualTo(7);
+    assertThat(invocations[1].afterInvocation).isEqualTo(8);
+    assertThat(invocations[0].afterInvocation).isEqualTo(9);
+  }
+
+  /**
+   * Used by test {@link #firstShouldBeFirstBeforeLastAfter()}
+   */
+  public static class ThreeRules {
+
+    static RuleList ruleListStatic;
+
+    public SpyRule ruleOne = new SpyRule("ruleOne", invocations[0]);
+    public SpyRule ruleTwo = new SpyRule("ruleTwo", invocations[1]);
+    public SpyRule ruleThree = new SpyRule("ruleThree", invocations[2]);
+
+    @Rule
+    public RuleList ruleList = new RuleList().add(ruleThree).add(ruleTwo).add(ruleOne);
+
+    @Test
+    public void doTest() throws Exception {
+      ruleListStatic = ruleList;
+      invocations[0].invokedTest();
+      invocations[1].invokedTest();
+      invocations[2].invokedTest();
+    }
+  }
+
+  /**
+   * Structure of rule callback and test invocations
+   */
+  public static class Invocations {
+
+    private final AtomicInteger counter;
+    int beforeInvocation = 0;
+    int testInvocation = 0;
+    int afterInvocation = 0;
+
+    Invocations(AtomicInteger counter) {
+      this.counter = counter;
+    }
+
+    void invokedTest() {
+      testInvocation = counter.incrementAndGet();
+    }
+    void invokedBefore() {
+      beforeInvocation = counter.incrementAndGet();
+    }
+    void invokedAfter() {
+      afterInvocation = counter.incrementAndGet();
+    }
+
+    @Override
+    public String toString() {
+      return "Invocations{" + "counter=" + counter + ", beforeInvocation=" + beforeInvocation + ", testInvocation=" + testInvocation + ", afterInvocation=" + afterInvocation + '}';
+    }
+  }
+
+  /**
+   * Implementation of TestRule that records the order of callbacks invoked on
+   * it. Used by {@link RuleListTest}.
+   */
+  public static class SpyRule extends ExternalResource {
+
+    static SpyRuleBuilder builder() {
+      return new SpyRuleBuilder();
+    }
+
+    private final String name;
+    private final Invocations invocations;
+    private final Throwable beforeClassThrowable;
+    private final Throwable beforeThrowable;
+
+    SpyRule(String name, Invocations invocations) {
+      this.name = name;
+      this.invocations = invocations;
+      this.beforeClassThrowable = null;
+      this.beforeThrowable = null;
+    }
+
+    SpyRule(SpyRuleBuilder builder) {
+      this.name = builder.name;
+      this.invocations = builder.invocations;
+      this.beforeClassThrowable = builder.beforeClassThrowable;
+      this.beforeThrowable = builder.beforeThrowable;
+    }
+
+    Invocations invocations() {
+      return this.invocations;
+    }
+
+    void test() {
+      this.invocations.invokedTest();
+    }
+
+    @Override
+    protected void before() throws Throwable {
+      this.invocations.invokedBefore();
+      if (this.beforeThrowable != null) {
+        throw this.beforeThrowable;
+      }
+    }
+
+    @Override
+    protected void after() {
+      this.invocations.invokedAfter();
+    }
+
+    @Override
+    public String toString() {
+      return "SpyRule{" + "name='" + name + '\'' + '}';
+    }
+  }
+
+  /**
+   * Builder for more control of constructing an instance of {@link SpyRule}
+   */
+  public static class SpyRuleBuilder {
+
+    String name;
+    Invocations invocations;
+    Throwable beforeClassThrowable;
+    Throwable beforeThrowable;
+
+    SpyRuleBuilder withName(String name) {
+      this.name = name;
+      return this;
+    }
+
+    SpyRuleBuilder withInvocations(Invocations invocations) {
+      this.invocations = invocations;
+      return this;
+    }
+
+    SpyRuleBuilder beforeClassThrows(Throwable throwable) {
+      this.beforeClassThrowable = throwable;
+      return this;
+    }
+
+    SpyRuleBuilder beforeThrows(Throwable throwable) {
+      this.beforeThrowable = throwable;
+      return this;
+    }
+
+    SpyRule build() {
+      return new SpyRule(this);
+    }
+  }
+}


[2/5] incubator-geode git commit: Initial commit with refactored rules

Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/ExpectedTimeoutJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/ExpectedTimeoutJUnitTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/ExpectedTimeoutJUnitTest.java
deleted file mode 100755
index 24ebdde..0000000
--- a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/ExpectedTimeoutJUnitTest.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.test.junit.rules;
-
-import static org.hamcrest.core.StringContains.*;
-import static org.hamcrest.core.Is.*;
-import static org.hamcrest.core.IsInstanceOf.*;
-import static org.junit.Assert.*;
-
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.runner.JUnitCore;
-import org.junit.runner.Request;
-import org.junit.runner.Result;
-import org.junit.runner.notification.Failure;
-
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-
-/**
- * Unit tests for ExpectedTimeout JUnit Rule.
- * 
- * @author Kirk Lund
- * @since 8.2
- */
-@Category(UnitTest.class)
-public class ExpectedTimeoutJUnitTest {
-
-  @Test
-  public void passesUnused() {
-    Result result = runTest(PassesUnused.class);
-    assertTrue(result.wasSuccessful());
-  }
-  
-  @Test
-  public void failsWithoutExpectedException() {
-    Result result = runTest(FailsWithoutExpectedException.class);
-    assertFalse(result.wasSuccessful());
-    List<Failure> failures = result.getFailures();
-    assertEquals(1, failures.size());
-    Failure failure = failures.get(0);
-    assertThat(failure.getException(), is(instanceOf(AssertionError.class)));
-    assertThat(failure.getException().getMessage(), containsString("Expected test to throw an instance of " + TimeoutException.class.getName()));
-  }
-  
-  @Test
-  public void failsWithoutExpectedTimeoutException() {
-    Result result = runTest(FailsWithoutExpectedTimeoutException.class);
-    assertFalse(result.wasSuccessful());
-    List<Failure> failures = result.getFailures();
-    assertEquals(1, failures.size());
-    Failure failure = failures.get(0);
-    assertThat(failure.getException(), is(instanceOf(AssertionError.class)));
-    assertThat(failure.getException().getMessage(), containsString("Expected test to throw (an instance of " + TimeoutException.class.getName() + " and exception with message a string containing \"" + FailsWithoutExpectedTimeoutException.message + "\")"));
-  }
-  
-  @Test
-  public void failsWithExpectedTimeoutButWrongError() {
-    Result result = runTest(FailsWithExpectedTimeoutButWrongError.class);
-    assertFalse(result.wasSuccessful());
-    List<Failure> failures = result.getFailures();
-    assertEquals(1, failures.size());
-    Failure failure = failures.get(0);
-    assertThat(failure.getException(), is(instanceOf(AssertionError.class)));
-    assertThat(failure.getException().getMessage(), containsString(NullPointerException.class.getName()));
-  }
-  
-  @Test
-  public void passesWithExpectedTimeoutAndTimeoutException() {
-    Result result = runTest(PassesWithExpectedTimeoutAndTimeoutException.class);
-    assertTrue(result.wasSuccessful());
-  }
-  
-  @Test
-  public void failsWhenTimeoutIsEarly() {
-    Result result = runTest(FailsWhenTimeoutIsEarly.class);
-    assertFalse(result.wasSuccessful());
-    List<Failure> failures = result.getFailures();
-    assertEquals(1, failures.size());
-    Failure failure = failures.get(0);
-    assertThat(failure.getException(), is(instanceOf(AssertionError.class)));
-    assertThat(failure.getException().getMessage(), containsString("Expected test to throw (an instance of " + TimeoutException.class.getName() + " and exception with message a string containing \"" + FailsWhenTimeoutIsEarly.message + "\")"));
-  }
-  
-  @Test
-  public void failsWhenTimeoutIsLate() {
-    Result result = runTest(FailsWhenTimeoutIsLate.class);
-    assertFalse(result.wasSuccessful());
-    List<Failure> failures = result.getFailures();
-    assertEquals(1, failures.size());
-    Failure failure = failures.get(0);
-    assertThat(failure.getException(), is(instanceOf(AssertionError.class)));
-    assertThat(failure.getException().getMessage(), containsString("Expected test to throw (an instance of " + TimeoutException.class.getName() + " and exception with message a string containing \"" + FailsWhenTimeoutIsLate.message + "\")"));
-  }
-  
-  private static Result runTest(Class<?> test) {
-    JUnitCore junitCore = new JUnitCore();
-    return junitCore.run(Request.aClass(test).getRunner());
-  }
-  
-  public static class AbstractExpectedTimeoutTest {
-    @Rule
-    public ExpectedTimeout timeout = ExpectedTimeout.none();
-  }
-  
-  public static class PassesUnused extends AbstractExpectedTimeoutTest {
-    @Test
-    public void passesUnused() throws Exception {
-    }
-  }
-  
-  public static class FailsWithoutExpectedException extends AbstractExpectedTimeoutTest {
-    @Test
-    public void failsWithoutExpectedException() throws Exception {
-      timeout.expect(TimeoutException.class);
-    }
-  }
-  
-  public static class FailsWithoutExpectedTimeoutException extends AbstractExpectedTimeoutTest {
-    public static final String message = "this is a message for FailsWithoutExpectedTimeoutException";
-    @Test
-    public void failsWithoutExpectedTimeoutAndTimeoutException() throws Exception {
-      timeout.expect(TimeoutException.class);
-      timeout.expectMessage(message);
-      timeout.expectMinimumDuration(10);
-      timeout.expectMaximumDuration(1000);
-      timeout.expectTimeUnit(TimeUnit.MILLISECONDS);
-      Thread.sleep(100);
-    }
-  }
-  
-  public static class FailsWithExpectedTimeoutButWrongError extends AbstractExpectedTimeoutTest {
-    public static final String message = "this is a message for FailsWithExpectedTimeoutButWrongError";
-    @Test
-    public void failsWithExpectedTimeoutButWrongError() throws Exception {
-      timeout.expect(TimeoutException.class);
-      timeout.expectMessage(message);
-      timeout.expectMinimumDuration(10);
-      timeout.expectMaximumDuration(1000);
-      timeout.expectTimeUnit(TimeUnit.MILLISECONDS);
-      Thread.sleep(100);
-      throw new NullPointerException();
-    }
-  }
-
-  public static class PassesWithExpectedTimeoutAndTimeoutException extends AbstractExpectedTimeoutTest {
-    public static final String message = "this is a message for PassesWithExpectedTimeoutAndTimeoutException";
-    public static final Class<TimeoutException> exceptionClass = TimeoutException.class;
-    @Test
-    public void passesWithExpectedTimeoutAndTimeoutException() throws Exception {
-      timeout.expect(exceptionClass);
-      timeout.expectMessage(message);
-      timeout.expectMinimumDuration(10);
-      timeout.expectMaximumDuration(1000);
-      timeout.expectTimeUnit(TimeUnit.MILLISECONDS);
-      Thread.sleep(100);
-      throw new TimeoutException(message);
-    }
-  }
-
-  public static class FailsWhenTimeoutIsEarly extends AbstractExpectedTimeoutTest {
-    public static final String message = "this is a message for FailsWhenTimeoutIsEarly";
-    @Test
-    public void failsWhenTimeoutIsEarly() throws Exception {
-      timeout.expect(TimeoutException.class);
-      timeout.expectMessage(message);
-      timeout.expectMinimumDuration(1000);
-      timeout.expectMaximumDuration(2000);
-      timeout.expectTimeUnit(TimeUnit.MILLISECONDS);
-      Thread.sleep(10);
-    }
-  }
-
-  public static class FailsWhenTimeoutIsLate extends AbstractExpectedTimeoutTest {
-    public static final String message = "this is a message for FailsWhenTimeoutIsLate";
-    @Test
-    public void failsWhenTimeoutIsLate() throws Exception {
-      timeout.expect(TimeoutException.class);
-      timeout.expectMessage(message);
-      timeout.expectMinimumDuration(10);
-      timeout.expectMaximumDuration(20);
-      timeout.expectTimeUnit(TimeUnit.MILLISECONDS);
-      Thread.sleep(100);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/ExpectedTimeoutRuleTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/ExpectedTimeoutRuleTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/ExpectedTimeoutRuleTest.java
new file mode 100755
index 0000000..f2191f0
--- /dev/null
+++ b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/ExpectedTimeoutRuleTest.java
@@ -0,0 +1,212 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.rules;
+
+import static org.assertj.core.api.Assertions.*;
+
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
+
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+/**
+ * Unit tests for {@link ExpectedTimeoutRule}.
+ * 
+ * @author Kirk Lund
+ * @since 8.2
+ */
+@Category(UnitTest.class)
+public class ExpectedTimeoutRuleTest {
+
+  @Test
+  public void passesUnused() {
+    Result result = TestRunner.runTest(PassingTestShouldPassWhenUnused.class);
+    
+    assertThat(result.wasSuccessful()).isTrue();
+  }
+  
+  @Test
+  public void failsWithoutExpectedException() {
+    Result result = TestRunner.runTest(FailsWithoutExpectedException.class);
+    
+    assertThat(result.wasSuccessful()).isFalse();
+    
+    List<Failure> failures = result.getFailures();
+    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
+    
+    Failure failure = failures.get(0);
+    assertThat(failure.getException()).isExactlyInstanceOf(AssertionError.class).hasMessage("Expected test to throw an instance of " + TimeoutException.class.getName());
+  }
+  
+  @Test
+  public void failsWithoutExpectedTimeoutException() {
+    Result result = TestRunner.runTest(FailsWithoutExpectedTimeoutException.class);
+    
+    assertThat(result.wasSuccessful()).isFalse();
+    
+    List<Failure> failures = result.getFailures();
+    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
+    
+    Failure failure = failures.get(0);
+    assertThat(failure.getException()).isExactlyInstanceOf(AssertionError.class).hasMessage("Expected test to throw (an instance of " + TimeoutException.class.getName() + " and exception with message a string containing \"" + FailsWithoutExpectedTimeoutException.message + "\")");
+  }
+  
+  @Test
+  public void failsWithExpectedTimeoutButWrongError() {
+    Result result = TestRunner.runTest(FailsWithExpectedTimeoutButWrongError.class);
+    
+    assertThat(result.wasSuccessful()).isFalse();
+    
+    List<Failure> failures = result.getFailures();
+    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
+    
+    Failure failure = failures.get(0);
+    String expectedMessage = 
+        "\n" + 
+        "Expected: (an instance of java.util.concurrent.TimeoutException and exception with message a string containing \"this is a message for FailsWithExpectedTimeoutButWrongError\")" +
+        "\n" + 
+        "     " +
+        "but: an instance of java.util.concurrent.TimeoutException <java.lang.NullPointerException> is a java.lang.NullPointerException";
+    assertThat(failure.getException()).isExactlyInstanceOf(AssertionError.class).hasMessageContaining(expectedMessage);
+  }
+  
+  @Test
+  public void passesWithExpectedTimeoutAndTimeoutException() {
+    Result result = TestRunner.runTest(PassesWithExpectedTimeoutAndTimeoutException.class);
+    
+    assertThat(result.wasSuccessful()).isTrue();
+  }
+  
+  @Test
+  public void failsWhenTimeoutIsEarly() {
+    Result result = TestRunner.runTest(FailsWhenTimeoutIsEarly.class);
+   
+    assertThat(result.wasSuccessful()).isFalse();
+    
+    List<Failure> failures = result.getFailures();
+    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
+    
+    Failure failure = failures.get(0);
+    assertThat(failure.getException()).isExactlyInstanceOf(AssertionError.class).hasMessage("Expected test to throw (an instance of " + TimeoutException.class.getName() + " and exception with message a string containing \"" + FailsWhenTimeoutIsEarly.message + "\")");
+  }
+  
+  @Test
+  public void failsWhenTimeoutIsLate() {
+    Result result = TestRunner.runTest(FailsWhenTimeoutIsLate.class);
+    
+    assertThat(result.wasSuccessful()).isFalse();
+    
+    List<Failure> failures = result.getFailures();
+    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
+    
+    Failure failure = failures.get(0);
+    assertThat(failure.getException()).isExactlyInstanceOf(AssertionError.class).hasMessage("Expected test to throw (an instance of " + TimeoutException.class.getName() + " and exception with message a string containing \"" + FailsWhenTimeoutIsLate.message + "\")");
+  }
+  
+  public static class AbstractExpectedTimeoutRuleTest {
+    @Rule
+    public ExpectedTimeoutRule timeout = ExpectedTimeoutRule.none();
+  }
+  
+  public static class PassingTestShouldPassWhenUnused extends AbstractExpectedTimeoutRuleTest {
+    @Test
+    public void passesUnused() throws Exception {
+    }
+  }
+  
+  public static class FailsWithoutExpectedException extends AbstractExpectedTimeoutRuleTest {
+    @Test
+    public void failsWithoutExpectedException() throws Exception {
+      timeout.expect(TimeoutException.class);
+    }
+  }
+  
+  public static class FailsWithoutExpectedTimeoutException extends AbstractExpectedTimeoutRuleTest {
+    public static final String message = "this is a message for FailsWithoutExpectedTimeoutException";
+    @Test
+    public void failsWithoutExpectedTimeoutAndTimeoutException() throws Exception {
+      timeout.expect(TimeoutException.class);
+      timeout.expectMessage(message);
+      timeout.expectMinimumDuration(10);
+      timeout.expectMaximumDuration(1000);
+      timeout.expectTimeUnit(TimeUnit.MILLISECONDS);
+      Thread.sleep(100);
+    }
+  }
+  
+  public static class FailsWithExpectedTimeoutButWrongError extends AbstractExpectedTimeoutRuleTest {
+    public static final String message = "this is a message for FailsWithExpectedTimeoutButWrongError";
+    @Test
+    public void failsWithExpectedTimeoutButWrongError() throws Exception {
+      timeout.expect(TimeoutException.class);
+      timeout.expectMessage(message);
+      timeout.expectMinimumDuration(10);
+      timeout.expectMaximumDuration(1000);
+      timeout.expectTimeUnit(TimeUnit.MILLISECONDS);
+      Thread.sleep(100);
+      throw new NullPointerException();
+    }
+  }
+
+  public static class PassesWithExpectedTimeoutAndTimeoutException extends AbstractExpectedTimeoutRuleTest {
+    public static final String message = "this is a message for PassesWithExpectedTimeoutAndTimeoutException";
+    public static final Class<TimeoutException> exceptionClass = TimeoutException.class;
+    @Test
+    public void passesWithExpectedTimeoutAndTimeoutException() throws Exception {
+      timeout.expect(exceptionClass);
+      timeout.expectMessage(message);
+      timeout.expectMinimumDuration(10);
+      timeout.expectMaximumDuration(1000);
+      timeout.expectTimeUnit(TimeUnit.MILLISECONDS);
+      Thread.sleep(100);
+      throw new TimeoutException(message);
+    }
+  }
+
+  public static class FailsWhenTimeoutIsEarly extends AbstractExpectedTimeoutRuleTest {
+    public static final String message = "this is a message for FailsWhenTimeoutIsEarly";
+    @Test
+    public void failsWhenTimeoutIsEarly() throws Exception {
+      timeout.expect(TimeoutException.class);
+      timeout.expectMessage(message);
+      timeout.expectMinimumDuration(1000);
+      timeout.expectMaximumDuration(2000);
+      timeout.expectTimeUnit(TimeUnit.MILLISECONDS);
+      Thread.sleep(10);
+    }
+  }
+
+  public static class FailsWhenTimeoutIsLate extends AbstractExpectedTimeoutRuleTest {
+    public static final String message = "this is a message for FailsWhenTimeoutIsLate";
+    @Test
+    public void failsWhenTimeoutIsLate() throws Exception {
+      timeout.expect(TimeoutException.class);
+      timeout.expectMessage(message);
+      timeout.expectMinimumDuration(10);
+      timeout.expectMaximumDuration(20);
+      timeout.expectTimeUnit(TimeUnit.MILLISECONDS);
+      Thread.sleep(100);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/IgnoreUntilRuleTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/IgnoreUntilRuleTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/IgnoreUntilRuleTest.java
new file mode 100755
index 0000000..568bec5
--- /dev/null
+++ b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/IgnoreUntilRuleTest.java
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.rules;
+
+import static org.assertj.core.api.Assertions.*;
+
+import java.util.List;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
+
+import com.gemstone.gemfire.test.junit.IgnoreUntil;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+/**
+ * Unit tests for {@link IgnoreUntilRule}.
+ * 
+ * @author Kirk Lund
+ */
+@Category(UnitTest.class)
+public class IgnoreUntilRuleTest {
+
+  private static final String ASSERTION_ERROR_MESSAGE = "failing test";
+  
+  @Test
+  public void shouldIgnoreWhenUntilIsInFuture() {
+    Result result = TestRunner.runTest(ShouldIgnoreWhenUntilIsInFuture.class);
+    
+    assertThat(result.wasSuccessful()).isTrue();
+    assertThat(ShouldIgnoreWhenUntilIsInFuture.count).isEqualTo(0);
+  }
+  
+  @Test
+  public void shouldExecuteWhenUntilIsInPast() {
+    Result result = TestRunner.runTest(ShouldExecuteWhenUntilIsInPast.class);
+    
+    assertThat(result.wasSuccessful()).isFalse();
+    
+    List<Failure> failures = result.getFailures();
+    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
+
+    Failure failure = failures.get(0);
+    assertThat(failure.getException()).isExactlyInstanceOf(AssertionError.class).hasMessage(ASSERTION_ERROR_MESSAGE);
+    assertThat(ShouldExecuteWhenUntilIsInPast.count).isEqualTo(1);
+  }
+  
+  @Test
+  public void shouldExecuteWhenUntilIsDefault() {
+    Result result = TestRunner.runTest(ShouldExecuteWhenUntilIsDefault.class);
+    
+    assertThat(result.wasSuccessful()).isFalse();
+    
+    List<Failure> failures = result.getFailures();
+    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
+
+    Failure failure = failures.get(0);
+    assertThat(failure.getException()).isExactlyInstanceOf(AssertionError.class).hasMessage(ASSERTION_ERROR_MESSAGE);
+    assertThat(ShouldExecuteWhenUntilIsDefault.count).isEqualTo(1);
+  }
+  
+  public static class ShouldIgnoreWhenUntilIsInFuture {
+    private static int count;
+    
+    @Rule
+    public final IgnoreUntilRule ignoreUntilRule = new IgnoreUntilRule();
+    
+    @Test
+    @IgnoreUntil(value = "description", until = "3000-01-01")
+    public void doTest() throws Exception {
+      count++;
+      fail(ASSERTION_ERROR_MESSAGE);
+    }
+  }
+
+  public static class ShouldExecuteWhenUntilIsInPast {
+    private static int count;
+    
+    @Rule
+    public final IgnoreUntilRule ignoreUntilRule = new IgnoreUntilRule();
+    
+    @Test
+    @IgnoreUntil(value = "description", until = "1980-01-01")
+    public void doTest() throws Exception {
+      count++;
+      fail(ASSERTION_ERROR_MESSAGE);
+    }
+  }
+
+  public static class ShouldExecuteWhenUntilIsDefault {
+    private static int count;
+    
+    @Rule
+    public final IgnoreUntilRule ignoreUntilRule = new IgnoreUntilRule();
+    
+    @Test
+    @IgnoreUntil(value = "description")
+    public void doTest() throws Exception {
+      count++;
+      fail(ASSERTION_ERROR_MESSAGE);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RepeatRuleTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RepeatRuleTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RepeatRuleTest.java
new file mode 100755
index 0000000..e17bc51
--- /dev/null
+++ b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RepeatRuleTest.java
@@ -0,0 +1,302 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.rules;
+
+import static org.assertj.core.api.Assertions.*;
+
+import java.util.List;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
+
+import com.gemstone.gemfire.test.junit.Repeat;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+/**
+ * Unit tests for {@link RepeatRule}.
+ * 
+ * @author Kirk Lund
+ */
+@Category(UnitTest.class)
+public class RepeatRuleTest {
+
+  private static final String ASSERTION_ERROR_MESSAGE = "failing test";
+  
+  @Test
+  public void failingTestShouldFailOneTimeWhenRepeatIsUnused() {
+    Result result = TestRunner.runTest(FailingTestShouldFailOneTimeWhenRepeatIsUnused.class);
+    
+    assertThat(result.wasSuccessful()).isFalse();
+    
+    List<Failure> failures = result.getFailures();
+    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
+
+    Failure failure = failures.get(0);
+    assertThat(failure.getException()).isExactlyInstanceOf(AssertionError.class).hasMessage(ASSERTION_ERROR_MESSAGE);
+    assertThat(FailingTestShouldFailOneTimeWhenRepeatIsUnused.count).isEqualTo(1);
+  }
+
+  @Test
+  public void passingTestShouldPassOneTimeWhenRepeatIsUnused() {
+    Result result = TestRunner.runTest(PassingTestShouldPassOneTimeWhenRepeatIsUnused.class);
+    
+    assertThat(result.wasSuccessful()).isTrue();
+    assertThat(PassingTestShouldPassOneTimeWhenRepeatIsUnused.count).isEqualTo(1);
+  }
+
+  @Test
+  public void zeroValueShouldThrowIllegalArgumentException() {
+    Result result = TestRunner.runTest(ZeroValueShouldThrowIllegalArgumentException.class);
+    
+    assertThat(result.wasSuccessful()).isFalse();
+    
+    List<Failure> failures = result.getFailures();
+    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
+
+    Failure failure = failures.get(0);
+    assertThat(failure.getException()).isExactlyInstanceOf(IllegalArgumentException.class).hasMessage("Repeat value must be a positive integer");
+    assertThat(ZeroValueShouldThrowIllegalArgumentException.count).isEqualTo(0);
+  }
+  
+  @Test
+  public void negativeValueShouldThrowIllegalArgumentException() {
+    Result result = TestRunner.runTest(NegativeValueShouldThrowIllegalArgumentException.class);
+    
+    assertThat(result.wasSuccessful()).isFalse();
+    
+    List<Failure> failures = result.getFailures();
+    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
+
+    Failure failure = failures.get(0);
+    assertThat(failure.getException()).isExactlyInstanceOf(IllegalArgumentException.class).hasMessage("Repeat value must be a positive integer");
+    assertThat(NegativeValueShouldThrowIllegalArgumentException.count).isEqualTo(0);
+  }
+
+  @Test
+  public void failingTestShouldFailOneTimeWhenRepeatIsOne() {
+    Result result = TestRunner.runTest(FailingTestShouldFailOneTimeWhenRepeatIsOne.class);
+    
+    assertThat(result.wasSuccessful()).isFalse();
+    
+    List<Failure> failures = result.getFailures();
+    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
+
+    Failure failure = failures.get(0);
+    assertThat(failure.getException()).isExactlyInstanceOf(AssertionError.class).hasMessage(ASSERTION_ERROR_MESSAGE);
+    assertThat(FailingTestShouldFailOneTimeWhenRepeatIsOne.count).isEqualTo(1);
+  }
+
+  @Test
+  public void passingTestShouldPassOneTimeWhenRepeatIsOne() {
+    Result result = TestRunner.runTest(PassingTestShouldPassOneTimeWhenRepeatIsOne.class);
+    
+    assertThat(result.wasSuccessful()).isTrue();
+    assertThat(PassingTestShouldPassOneTimeWhenRepeatIsOne.count).isEqualTo(1);
+  }
+
+  @Test
+  public void failingTestShouldFailOneTimeWhenRepeatIsTwo() {
+    Result result = TestRunner.runTest(FailingTestShouldFailOneTimeWhenRepeatIsTwo.class);
+    
+    assertThat(result.wasSuccessful()).isFalse();
+    
+    List<Failure> failures = result.getFailures();
+    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
+
+    Failure failure = failures.get(0);
+    assertThat(failure.getException()).isExactlyInstanceOf(AssertionError.class).hasMessage(ASSERTION_ERROR_MESSAGE);
+    assertThat(FailingTestShouldFailOneTimeWhenRepeatIsTwo.count).isEqualTo(1);
+  }
+
+  @Test
+  public void passingTestShouldPassTwoTimesWhenRepeatIsTwo() {
+    Result result = TestRunner.runTest(PassingTestShouldPassTwoTimesWhenRepeatIsTwo.class);
+    
+    assertThat(result.wasSuccessful()).isTrue();
+    assertThat(PassingTestShouldPassTwoTimesWhenRepeatIsTwo.count).isEqualTo(2);
+  }
+
+  @Test
+  public void failingTestShouldFailOneTimeWhenRepeatIsThree() {
+    Result result = TestRunner.runTest(FailingTestShouldFailOneTimeWhenRepeatIsThree.class);
+    
+    assertThat(result.wasSuccessful()).isFalse();
+    
+    List<Failure> failures = result.getFailures();
+    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
+
+    Failure failure = failures.get(0);
+    assertThat(failure.getException()).isExactlyInstanceOf(AssertionError.class).hasMessage(ASSERTION_ERROR_MESSAGE);
+    assertThat(FailingTestShouldFailOneTimeWhenRepeatIsThree.count).isEqualTo(1);
+  }
+
+  @Test
+  public void passingTestShouldPassThreeTimesWhenRepeatIsThree() {
+    Result result = TestRunner.runTest(PassingTestShouldPassThreeTimesWhenRepeatIsThree.class);
+    
+    assertThat(result.wasSuccessful()).isTrue();
+    assertThat(PassingTestShouldPassThreeTimesWhenRepeatIsThree.count).isEqualTo(3);
+  }
+
+  public static class FailingTestShouldFailOneTimeWhenRepeatIsUnused {
+    protected static int count = 0;
+    
+    @Rule
+    public RepeatRule repeat = new RepeatRule();
+
+    @Test
+    public void doTest() throws Exception {
+      count++;
+      fail(ASSERTION_ERROR_MESSAGE);
+    }
+  }
+
+  public static class PassingTestShouldPassOneTimeWhenRepeatIsUnused {
+    protected static int count = 0;
+    
+    @Rule
+    public RepeatRule repeat = new RepeatRule();
+
+    @Test
+    public void doTest() throws Exception {
+      count++;
+    }
+  }
+
+  public static class ZeroValueShouldThrowIllegalArgumentException {
+    protected static int count = 0;
+    
+    @Rule
+    public RepeatRule repeat = new RepeatRule();
+
+    @Test
+    @Repeat(0)
+    public void doTest() throws Exception {
+      count++;
+    }
+  }
+
+  public static class NegativeValueShouldThrowIllegalArgumentException {
+    protected static int count = 0;
+    
+    @Rule
+    public RepeatRule repeat = new RepeatRule();
+
+    @Test
+    @Repeat(-1)
+    public void doTest() throws Exception {
+      count++;
+    }
+  }
+
+  public static class PassingTestShouldBeSkippedWhenRepeatIsZero {
+    protected static int count = 0;
+    
+    @Rule
+    public RepeatRule repeat = new RepeatRule();
+
+    @Test
+    @Repeat(0)
+    public void doTest() throws Exception {
+      count++;
+    }
+  }
+  
+  public static class FailingTestShouldFailOneTimeWhenRepeatIsOne {
+    protected static int count = 0;
+    
+    @Rule
+    public RepeatRule repeat = new RepeatRule();
+
+    @Test
+    @Repeat(1)
+    public void doTest() throws Exception {
+      count++;
+      fail(ASSERTION_ERROR_MESSAGE);
+    }
+  }
+
+  public static class PassingTestShouldPassOneTimeWhenRepeatIsOne {
+    protected static int count = 0;
+    
+    @Rule
+    public RepeatRule repeat = new RepeatRule();
+
+    @Test
+    @Repeat(1)
+    public void doTest() throws Exception {
+      count++;
+    }
+  }
+
+  public static class FailingTestShouldFailOneTimeWhenRepeatIsTwo {
+    protected static int count = 0;
+    
+    @Rule
+    public RepeatRule repeat = new RepeatRule();
+
+    @Test
+    @Repeat(2)
+    public void doTest() throws Exception {
+      count++;
+      fail(ASSERTION_ERROR_MESSAGE);
+    }
+  }
+
+  public static class PassingTestShouldPassTwoTimesWhenRepeatIsTwo {
+    protected static int count = 0;
+    
+    @Rule
+    public RepeatRule repeat = new RepeatRule();
+
+    @Test
+    @Repeat(2)
+    public void doTest() throws Exception {
+      count++;
+    }
+  }
+
+  public static class FailingTestShouldFailOneTimeWhenRepeatIsThree {
+    protected static int count = 0;
+    
+    @Rule
+    public RepeatRule repeat = new RepeatRule();
+
+    @Test
+    @Repeat(3)
+    public void doTest() throws Exception {
+      count++;
+      fail(ASSERTION_ERROR_MESSAGE);
+    }
+  }
+
+  public static class PassingTestShouldPassThreeTimesWhenRepeatIsThree {
+    protected static int count = 0;
+    
+    @Rule
+    public RepeatRule repeat = new RepeatRule();
+
+    @Test
+    @Repeat(3)
+    public void doTest() throws Exception {
+      count++;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RetryRuleGlobalWithErrorTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RetryRuleGlobalWithErrorTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RetryRuleGlobalWithErrorTest.java
new file mode 100755
index 0000000..ee51c4e
--- /dev/null
+++ b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RetryRuleGlobalWithErrorTest.java
@@ -0,0 +1,249 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.rules;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.junit.Assert.fail;
+
+import java.util.List;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
+
+import com.gemstone.gemfire.test.junit.Retry;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+/**
+ * Unit tests for {@link RetryRule} involving global scope (ie rule affects all
+ * tests in the test class) with failures due to an {@code Error}.
+ * 
+ * @author Kirk Lund
+ * @see com.gemstone.gemfire.test.junit.rules.RetryRule
+ */
+@Category(UnitTest.class)
+public class RetryRuleGlobalWithErrorTest {
+  
+  @Test
+  public void zeroIsIllegal() {
+    Result result = TestRunner.runTest(ZeroIsIllegal.class);
+    
+    assertThat(result.wasSuccessful()).isFalse();
+    
+    List<Failure> failures = result.getFailures();
+    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
+
+    Failure failure = failures.get(0);
+    assertThat(failure.getException()).isExactlyInstanceOf(IllegalArgumentException.class).hasMessage(ZeroIsIllegal.message);
+    assertThat(ZeroIsIllegal.count).isEqualTo(0);
+  }
+  
+  @Test
+  public void failsWithOne() {
+    Result result = TestRunner.runTest(FailsWithOne.class);
+    
+    assertThat(result.wasSuccessful()).isFalse();
+    
+    List<Failure> failures = result.getFailures();
+    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
+
+    Failure failure = failures.get(0);
+    assertThat(failure.getException()).isExactlyInstanceOf(AssertionError.class).hasMessage(FailsWithOne.message);
+    assertThat(FailsWithOne.count).isEqualTo(1);
+  }
+  
+  @Test
+  public void passesWithOne() {
+    Result result = TestRunner.runTest(PassesWithOne.class);
+    
+    assertThat(result.wasSuccessful()).isTrue();
+    assertThat(PassesWithOne.count).isEqualTo(1);
+  }
+  
+  @Test
+  public void passesWithUnused() {
+    Result result = TestRunner.runTest(PassesWhenUnused.class);
+    
+    assertThat(result.wasSuccessful()).isTrue();
+    assertThat(PassesWhenUnused.count).isEqualTo(1);
+  }
+  
+  @Test
+  public void failsOnSecondAttempt() {
+    Result result = TestRunner.runTest(FailsOnSecondAttempt.class);
+    
+    assertThat(result.wasSuccessful()).isFalse();
+    
+    List<Failure> failures = result.getFailures();
+    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
+
+    Failure failure = failures.get(0);
+    assertThat(failure.getException()).isExactlyInstanceOf(AssertionError.class).hasMessage(FailsOnSecondAttempt.message);
+    assertThat(FailsOnSecondAttempt.count).isEqualTo(2);
+  }
+
+  @Test
+  public void passesOnSecondAttempt() {
+    Result result = TestRunner.runTest(PassesOnSecondAttempt.class);
+    
+    assertThat(result.wasSuccessful()).isTrue();
+    assertThat(PassesOnSecondAttempt.count).isEqualTo(2);
+  }
+  
+  @Test
+  public void failsOnThirdAttempt() {
+    Result result = TestRunner.runTest(FailsOnThirdAttempt.class);
+    
+    assertThat(result.wasSuccessful()).isFalse();
+    
+    List<Failure> failures = result.getFailures();
+    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
+
+    Failure failure = failures.get(0);
+    assertThat(failure.getException()).isExactlyInstanceOf(AssertionError.class).hasMessage(FailsOnThirdAttempt.message);
+    assertThat(FailsOnThirdAttempt.count).isEqualTo(3);
+  }
+
+  @Test
+  public void passesOnThirdAttempt() {
+    Result result = TestRunner.runTest(PassesOnThirdAttempt.class);
+    
+    assertThat(result.wasSuccessful()).isTrue();
+    assertThat(PassesOnThirdAttempt.count).isEqualTo(3);
+  }
+  
+  public static class ZeroIsIllegal {
+    protected static int count;
+    protected static final String message = "Retry count must be greater than zero";
+
+    @Rule
+    public RetryRule retryRule = new RetryRule(0);
+
+    @Test
+    public void zeroIsIllegal() throws Exception {
+      count++;
+    }
+  }
+  
+  public static class FailsWithOne {
+    protected static int count;
+    protected static String message;
+
+    @Rule
+    public RetryRule retryRule = new RetryRule(1);
+
+    @Test
+    public void failsWithOne() throws Exception {
+      count++;
+      message = "Failing " + count;
+      fail(message);
+    }
+  }
+  
+  public static class PassesWithOne {
+    protected static int count;
+
+    @Rule
+    public RetryRule retryRule = new RetryRule(1);
+
+    @Test
+    public void passesWithOne() throws Exception {
+      count++;
+    }
+  }
+  
+  public static class PassesWhenUnused {
+    protected static int count;
+
+    @Rule
+    public RetryRule retryRule = new RetryRule(2);
+
+    @Test
+    public void passesWithUnused() throws Exception {
+      count++;
+    }
+  }
+  
+  public static class FailsOnSecondAttempt {
+    protected static int count;
+    protected static String message;
+
+    @Rule
+    public RetryRule retryRule = new RetryRule(2);
+
+    @Test
+    @Retry(2)
+    public void failsOnSecondAttempt() {
+      count++;
+      message = "Failing " + count;
+      fail(message);
+    }
+  }
+  
+  public static class PassesOnSecondAttempt {
+    protected static int count;
+    protected static String message;
+    
+    @Rule
+    public RetryRule retryRule = new RetryRule(2);
+
+    @Test
+    @Retry(2)
+    public void failsOnSecondAttempt() {
+      count++;
+      if (count < 2) {
+        message = "Failing " + count;
+        fail(message);
+      }
+    }
+  }
+  
+  public static class FailsOnThirdAttempt {
+    protected static int count;
+    protected static String message;
+
+    @Rule
+    public RetryRule retryRule = new RetryRule(3);
+
+    @Test
+    @Retry(3)
+    public void failsOnThirdAttempt() {
+      count++;
+      message = "Failing " + count;
+      fail(message);
+    }
+  }
+
+  public static class PassesOnThirdAttempt {
+    protected static int count;
+    protected static String message;
+
+    @Rule
+    public RetryRule retryRule = new RetryRule(3);
+
+    @Test
+    public void failsOnThirdAttempt() {
+      count++;
+      if (count < 3) {
+        message = "Failing " + count;
+        fail(message);
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RetryRuleGlobalWithExceptionTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RetryRuleGlobalWithExceptionTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RetryRuleGlobalWithExceptionTest.java
new file mode 100755
index 0000000..4afa2c2
--- /dev/null
+++ b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RetryRuleGlobalWithExceptionTest.java
@@ -0,0 +1,253 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.rules;
+
+import static org.assertj.core.api.Assertions.*;
+
+import java.util.List;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
+
+import com.gemstone.gemfire.test.junit.Retry;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+/**
+ * Unit tests for {@link RetryRule} involving global scope (ie rule affects all
+ * tests in the test class) with failures due to an {@code Exception}.
+ * 
+ * @author Kirk Lund
+ * @see com.gemstone.gemfire.test.junit.rules.RetryRule
+ */
+@Category(UnitTest.class)
+public class RetryRuleGlobalWithExceptionTest {
+  
+  @Test
+  public void zeroIsIllegal() {
+    Result result = TestRunner.runTest(ZeroIsIllegal.class);
+    
+    assertThat(result.wasSuccessful()).isFalse();
+    
+    List<Failure> failures = result.getFailures();
+    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
+
+    Failure failure = failures.get(0);
+    assertThat(failure.getException()).isExactlyInstanceOf(IllegalArgumentException.class).hasMessage(ZeroIsIllegal.message);
+    assertThat(ZeroIsIllegal.count).isEqualTo(0);
+  }
+  
+  @Test
+  public void failsWithOne() {
+    Result result = TestRunner.runTest(FailsWithOne.class);
+    
+    assertThat(result.wasSuccessful()).isFalse();
+    
+    List<Failure> failures = result.getFailures();
+    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
+
+    Failure failure = failures.get(0);
+    assertThat(failure.getException()).isExactlyInstanceOf(CustomException.class).hasMessage(FailsWithOne.message);
+    assertThat(FailsWithOne.count).isEqualTo(1);
+  }
+  
+  @Test
+  public void passesWithOne() {
+    Result result = TestRunner.runTest(PassesWithOne.class);
+    
+    assertThat(result.wasSuccessful()).isTrue();
+  }
+  
+  @Test
+  public void passesWithUnused() {
+    Result result = TestRunner.runTest(PassesWhenUnused.class);
+    
+    assertThat(result.wasSuccessful()).isTrue();
+  }
+  
+  @Test
+  public void failsOnSecondAttempt() {
+    Result result = TestRunner.runTest(FailsOnSecondAttempt.class);
+    
+    assertThat(result.wasSuccessful()).isFalse();
+    
+    List<Failure> failures = result.getFailures();
+    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
+
+    Failure failure = failures.get(0);
+    assertThat(failure.getException()).isExactlyInstanceOf(CustomException.class).hasMessage(FailsOnSecondAttempt.message);
+    assertThat(FailsOnSecondAttempt.count).isEqualTo(2);
+  }
+
+  @Test
+  public void passesOnSecondAttempt() {
+    Result result = TestRunner.runTest(PassesOnSecondAttempt.class);
+    
+    assertThat(result.wasSuccessful()).isTrue();
+    assertThat(PassesOnSecondAttempt.count).isEqualTo(2);
+  }
+  
+  @Test
+  public void failsOnThirdAttempt() {
+    Result result = TestRunner.runTest(FailsOnThirdAttempt.class);
+    
+    assertThat(result.wasSuccessful()).isFalse();
+    
+    List<Failure> failures = result.getFailures();
+    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
+
+    Failure failure = failures.get(0);
+    assertThat(failure.getException()).isExactlyInstanceOf(CustomException.class).hasMessage(FailsOnThirdAttempt.message);
+    assertThat(FailsOnThirdAttempt.count).isEqualTo(3);
+  }
+
+  @Test
+  public void passesOnThirdAttempt() {
+    Result result = TestRunner.runTest(PassesOnThirdAttempt.class);
+    
+    assertThat(result.wasSuccessful()).isTrue();
+    assertThat(PassesOnThirdAttempt.count).isEqualTo(3);
+  }
+  
+  public static class CustomException extends Exception {
+    private static final long serialVersionUID = 1L;
+    public CustomException(final String message) {
+      super(message);
+    }
+  }
+  
+  public static class ZeroIsIllegal {
+    protected static int count;
+    protected static final String message = "Retry count must be greater than zero";
+
+    @Rule
+    public RetryRule retryRule = new RetryRule(0);
+
+    @Test
+    public void zeroIsIllegal() throws Exception {
+      count++;
+    }
+  }
+  
+  public static class FailsWithOne {
+    protected static int count;
+    protected static String message;
+
+    @Rule
+    public RetryRule retryRule = new RetryRule(1);
+
+    @Test
+    public void failsWithOne() throws Exception {
+      count++;
+      message = "Failing " + count;
+      throw new CustomException(message);
+    }
+  }
+  
+  public static class PassesWithOne {
+    protected static int count;
+
+    @Rule
+    public RetryRule retryRule = new RetryRule(1);
+
+    @Test
+    public void passesWithOne() throws Exception {
+      count++;
+    }
+  }
+  
+  public static class PassesWhenUnused {
+    protected static int count;
+
+    @Rule
+    public RetryRule retryRule = new RetryRule(2);
+
+    @Test
+    public void passesWithUnused() throws Exception {
+      count++;
+    }
+  }
+  
+  public static class FailsOnSecondAttempt {
+    protected static int count;
+    protected static String message;
+
+    @Rule
+    public RetryRule retryRule = new RetryRule(2);
+
+    @Test
+    @Retry(2)
+    public void failsOnSecondAttempt() throws Exception {
+      count++;
+      message = "Failing " + count;
+      throw new CustomException(message);
+    }
+  }
+  
+  public static class PassesOnSecondAttempt {
+    protected static int count;
+    protected static String message;
+    
+    @Rule
+    public RetryRule retryRule = new RetryRule(2);
+
+    @Test
+    @Retry(2)
+    public void failsOnSecondAttempt() throws Exception {
+      count++;
+      if (count < 2) {
+        message = "Failing " + count;
+        throw new CustomException(message);
+      }
+    }
+  }
+  
+  public static class FailsOnThirdAttempt {
+    protected static int count;
+    protected static String message;
+
+    @Rule
+    public RetryRule retryRule = new RetryRule(3);
+
+    @Test
+    @Retry(3)
+    public void failsOnThirdAttempt() throws Exception {
+      count++;
+      message = "Failing " + count;
+      throw new CustomException(message);
+    }
+  }
+
+  public static class PassesOnThirdAttempt {
+    protected static int count;
+    protected static String message;
+
+    @Rule
+    public RetryRule retryRule = new RetryRule(3);
+
+    @Test
+    public void failsOnThirdAttempt() throws Exception {
+      count++;
+      if (count < 3) {
+        message = "Failing " + count;
+        throw new CustomException(message);
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RetryRuleLocalWithErrorTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RetryRuleLocalWithErrorTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RetryRuleLocalWithErrorTest.java
new file mode 100755
index 0000000..ad3c258
--- /dev/null
+++ b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RetryRuleLocalWithErrorTest.java
@@ -0,0 +1,206 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.rules;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.junit.Assert.fail;
+
+import java.util.List;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
+
+import com.gemstone.gemfire.test.junit.Retry;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+/**
+ * Unit tests for {@link RetryRule} involving local scope (ie rule affects
+ * only the test methods annotated with {@code @Retry}) with failures due to
+ * an {@code Error}.
+ *
+ * @author Kirk Lund
+ */
+@Category(UnitTest.class)
+public class RetryRuleLocalWithErrorTest {
+
+  @Test
+  public void failsUnused() {
+    Result result = TestRunner.runTest(FailsUnused.class);
+    
+    assertThat(result.wasSuccessful()).isFalse();
+    
+    List<Failure> failures = result.getFailures();
+    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
+
+    Failure failure = failures.get(0);
+    assertThat(failure.getException()).isExactlyInstanceOf(AssertionError.class).hasMessage(FailsUnused.message);
+    assertThat(FailsUnused.count).isEqualTo(1);
+  }
+  
+  @Test
+  public void passesUnused() {
+    Result result = TestRunner.runTest(PassesUnused.class);
+    
+    assertThat(result.wasSuccessful()).isTrue();
+    assertThat(PassesUnused.count).isEqualTo(1);
+  }
+  
+  @Test
+  public void failsOnSecondAttempt() {
+    Result result = TestRunner.runTest(FailsOnSecondAttempt.class);
+    
+    assertThat(result.wasSuccessful()).isFalse();
+    
+    List<Failure> failures = result.getFailures();
+    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
+
+    Failure failure = failures.get(0);
+    assertThat(failure.getException()).isExactlyInstanceOf(AssertionError.class).hasMessage(FailsOnSecondAttempt.message);
+    assertThat(FailsOnSecondAttempt.count).isEqualTo(2);
+  }
+
+  @Test
+  public void passesOnSecondAttempt() {
+    Result result = TestRunner.runTest(PassesOnSecondAttempt.class);
+    
+    assertThat(result.wasSuccessful()).isTrue();
+    assertThat(PassesOnSecondAttempt.count).isEqualTo(2);
+  }
+  
+  @Test
+  public void failsOnThirdAttempt() {
+    Result result = TestRunner.runTest(FailsOnThirdAttempt.class);
+    
+    assertThat(result.wasSuccessful()).isFalse();
+    
+    List<Failure> failures = result.getFailures();
+    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
+
+    Failure failure = failures.get(0);
+    assertThat(failure.getException()).isExactlyInstanceOf(AssertionError.class).hasMessage(FailsOnThirdAttempt.message);
+    assertThat(FailsOnThirdAttempt.count).isEqualTo(3);
+  }
+
+  @Test
+  public void passesOnThirdAttempt() {
+    Result result = TestRunner.runTest(PassesOnThirdAttempt.class);
+    
+    assertThat(result.wasSuccessful()).isTrue();
+    assertThat(PassesOnThirdAttempt.count).isEqualTo(3);
+  }
+  
+  public static class FailsUnused {
+    protected static int count;
+    protected static String message;
+
+    @Rule
+    public RetryRule retryRule = new RetryRule();
+
+    @Test
+    public void failsUnused() throws Exception {
+      count++;
+      message = "Failing " + count;
+      fail(message);
+    }
+  }
+  
+  public static class PassesUnused {
+    protected static int count;
+    protected static String message;
+
+    @Rule
+    public RetryRule retryRule = new RetryRule();
+
+    @Test
+    public void passesUnused() throws Exception {
+      count++;
+    }
+  }
+  
+  public static class FailsOnSecondAttempt {
+    protected static int count;
+    protected static String message;
+    
+    @Rule
+    public RetryRule retryRule = new RetryRule();
+
+    @Test
+    @Retry(2)
+    public void failsOnSecondAttempt() {
+      count++;
+      message = "Failing " + count;
+      fail(message);
+    }
+  }
+  
+  public static class PassesOnSecondAttempt {
+    protected static int count;
+    protected static String message;
+    
+    @Rule
+    public RetryRule retryRule = new RetryRule();
+
+    @Test
+    @Retry(2)
+    public void failsOnSecondAttempt() {
+      count++;
+      if (count < 2) {
+        message = "Failing " + count;
+        fail(message);
+      }
+    }
+  }
+  
+  public static class FailsOnThirdAttempt {
+    protected static int count;
+    protected static String message;
+    
+    @Rule
+    public RetryRule retryRule = new RetryRule();
+
+    @Test
+    @Retry(3)
+    public void failsOnThirdAttempt() {
+      count++;
+
+      message = "Failing " + count;
+      fail(message);
+    }
+  }
+
+  public static class PassesOnThirdAttempt {
+    protected static int count;
+    protected static String message;
+    
+    @Rule
+    public RetryRule retryRule = new RetryRule();
+
+    @Test
+    @Retry(3)
+    public void failsOnThirdAttempt() {
+      count++;
+
+      if (count < 3) {
+        message = "Failing " + count;
+        fail(message);
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RetryRuleLocalWithExceptionTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RetryRuleLocalWithExceptionTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RetryRuleLocalWithExceptionTest.java
new file mode 100755
index 0000000..00363dd
--- /dev/null
+++ b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/RetryRuleLocalWithExceptionTest.java
@@ -0,0 +1,214 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.rules;
+
+import static org.assertj.core.api.Assertions.*;
+
+import java.util.List;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
+
+import com.gemstone.gemfire.test.junit.Retry;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+/**
+ * Unit tests for {@link RetryRule} involving local scope (ie rule affects
+ * only the test methods annotated with {@code @Retry}) with failures due to
+ * an {@code Exception}.
+ *
+ * @author Kirk Lund
+ * @see com.gemstone.gemfire.test.junit.Retry
+ * @see com.gemstone.gemfire.test.junit.rules.RetryRule
+ */
+@Category(UnitTest.class)
+public class RetryRuleLocalWithExceptionTest {
+
+  @Test
+  public void failsUnused() {
+    Result result = TestRunner.runTest(FailsUnused.class);
+    
+    assertThat(result.wasSuccessful()).isFalse();
+    
+    List<Failure> failures = result.getFailures();
+    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
+
+    Failure failure = failures.get(0);
+    assertThat(failure.getException()).isExactlyInstanceOf(CustomException.class).hasMessage(FailsUnused.message);
+    assertThat(FailsUnused.count).isEqualTo(1);
+  }
+  
+  @Test
+  public void passesUnused() {
+    Result result = TestRunner.runTest(PassesUnused.class);
+    
+    assertThat(result.wasSuccessful()).isTrue();
+    assertThat(PassesUnused.count).isEqualTo(1);
+  }
+  
+  @Test
+  public void failsOnSecondAttempt() {
+    Result result = TestRunner.runTest(FailsOnSecondAttempt.class);
+    
+    assertThat(result.wasSuccessful()).isFalse();
+    
+    List<Failure> failures = result.getFailures();
+    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
+
+    Failure failure = failures.get(0);
+    assertThat(failure.getException()).isExactlyInstanceOf(CustomException.class).hasMessage(FailsOnSecondAttempt.message);
+    assertThat(FailsOnSecondAttempt.count).isEqualTo(2);
+  }
+
+  @Test
+  public void passesOnSecondAttempt() {
+    Result result = TestRunner.runTest(PassesOnSecondAttempt.class);
+    
+    assertThat(result.wasSuccessful()).isTrue();
+    assertThat(PassesOnSecondAttempt.count).isEqualTo(2);
+  }
+  
+  @Test
+  public void failsOnThirdAttempt() {
+    Result result = TestRunner.runTest(FailsOnThirdAttempt.class);
+    
+    assertThat(result.wasSuccessful()).isFalse();
+    
+    List<Failure> failures = result.getFailures();
+    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
+
+    Failure failure = failures.get(0);
+    assertThat(failure.getException()).isExactlyInstanceOf(CustomException.class).hasMessage(FailsOnThirdAttempt.message);
+    assertThat(FailsOnThirdAttempt.count).isEqualTo(3);
+  }
+
+  @Test
+  public void passesOnThirdAttempt() {
+    Result result = TestRunner.runTest(PassesOnThirdAttempt.class);
+    
+    assertThat(result.wasSuccessful()).isTrue();
+    assertThat(PassesOnThirdAttempt.count).isEqualTo(3);
+  }
+  
+  public static class CustomException extends Exception {
+    private static final long serialVersionUID = 1L;
+    public CustomException(final String message) {
+      super(message);
+    }
+  }
+  
+  public static class FailsUnused {
+    protected static int count;
+    protected static String message;
+
+    @Rule
+    public RetryRule retryRule = new RetryRule();
+
+    @Test
+    public void failsUnused() throws Exception {
+      count++;
+      message = "Failing " + count;
+      throw new CustomException(message);
+    }
+  }
+  
+  public static class PassesUnused {
+    protected static int count;
+    protected static String message;
+
+    @Rule
+    public RetryRule retryRule = new RetryRule();
+
+    @Test
+    public void passesUnused() throws Exception {
+      count++;
+    }
+  }
+  
+  public static class FailsOnSecondAttempt {
+    protected static int count;
+    protected static String message;
+    
+    @Rule
+    public RetryRule retryRule = new RetryRule();
+
+    @Test
+    @Retry(2)
+    public void failsOnSecondAttempt() throws Exception {
+      count++;
+      message = "Failing " + count;
+      throw new CustomException(message);
+    }
+  }
+  
+  public static class PassesOnSecondAttempt {
+    protected static int count;
+    protected static String message;
+    
+    @Rule
+    public RetryRule retryRule = new RetryRule();
+
+    @Test
+    @Retry(2)
+    public void failsOnSecondAttempt() throws Exception {
+      count++;
+      if (count < 2) {
+        message = "Failing " + count;
+        throw new CustomException(message);
+      }
+    }
+  }
+  
+  public static class FailsOnThirdAttempt {
+    protected static int count;
+    protected static String message;
+    
+    @Rule
+    public RetryRule retryRule = new RetryRule();
+
+    @Test
+    @Retry(3)
+    public void failsOnThirdAttempt() throws Exception {
+      count++;
+
+      message = "Failing " + count;
+      throw new CustomException(message);
+    }
+  }
+
+  public static class PassesOnThirdAttempt {
+    protected static int count;
+    protected static String message;
+    
+    @Rule
+    public RetryRule retryRule = new RetryRule();
+
+    @Test
+    @Retry(3)
+    public void failsOnThirdAttempt() throws Exception {
+      count++;
+
+      if (count < 3) {
+        message = "Failing " + count;
+        throw new CustomException(message);
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/TestRunner.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/TestRunner.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/TestRunner.java
new file mode 100755
index 0000000..1ef85fc
--- /dev/null
+++ b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/TestRunner.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.rules;
+
+import org.junit.runner.JUnitCore;
+import org.junit.runner.Request;
+import org.junit.runner.Result;
+
+/**
+ * Used by JUnit rule unit tests to execute test cases.
+ * 
+ * @author Kirk Lund
+ */
+public class TestRunner {
+
+  protected TestRunner() {
+  }
+  
+  public static Result runTest(Class<?> test) {
+    JUnitCore junitCore = new JUnitCore();
+    return junitCore.run(Request.aClass(test).getRunner());
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/examples/RetryRuleExampleTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/examples/RetryRuleExampleTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/examples/RetryRuleExampleTest.java
index f6d70a2..257786e 100755
--- a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/examples/RetryRuleExampleTest.java
+++ b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/examples/RetryRuleExampleTest.java
@@ -18,13 +18,15 @@ package com.gemstone.gemfire.test.junit.rules.examples;
 
 import static org.assertj.core.api.Assertions.*;
 
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+import com.gemstone.gemfire.test.junit.rules.RetryRule;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-import com.gemstone.gemfire.test.junit.rules.RetryRule;
-
+/**
+ * Example usage of {@link RetryRule} with global scope.
+ */
 @Category(UnitTest.class)
 public class RetryRuleExampleTest {
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/examples/RuleAndClassRuleTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/examples/RuleAndClassRuleTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/examples/RuleAndClassRuleTest.java
new file mode 100755
index 0000000..27aa9f8
--- /dev/null
+++ b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/examples/RuleAndClassRuleTest.java
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.rules.examples;
+
+import static org.assertj.core.api.Assertions.*;
+
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+import com.gemstone.gemfire.test.junit.rules.TestRunner;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runner.Result;
+import org.junit.runners.model.Statement;
+
+/**
+ * Example usage of a rule as both a method \@Rule and a \@ClassRule.
+ */
+@Category(UnitTest.class)
+public class RuleAndClassRuleTest {
+
+  @Test
+  public void usingRuleAsRuleAndClassRuleShouldInvokeBeforeClass() {
+    Result result = TestRunner.runTest(UsingRuleAsRuleAndClassRule.class);
+    
+    assertThat(result.wasSuccessful()).isTrue();
+    assertThat(UsingRuleAsRuleAndClassRule.staticRule.beforeClassInvoked).isEqualTo(true);
+  }
+  
+  @Test
+  public void usingRuleAsRuleAndClassRuleShouldInvokeAfterClass() {
+    Result result = TestRunner.runTest(UsingRuleAsRuleAndClassRule.class);
+    
+    assertThat(result.wasSuccessful()).isTrue();
+    assertThat(UsingRuleAsRuleAndClassRule.staticRule.afterClassInvoked).isEqualTo(true);
+  }
+
+  @Test
+  public void usingRuleAsRuleAndClassRuleShouldInvokeBefore() {
+    Result result = TestRunner.runTest(UsingRuleAsRuleAndClassRule.class);
+    
+    assertThat(result.wasSuccessful()).isTrue();
+    assertThat(UsingRuleAsRuleAndClassRule.staticRule.beforeInvoked).isEqualTo(true);
+  }
+
+  @Test
+  public void usingRuleAsRuleAndClassRuleShouldInvokeAfter() {
+    Result result = TestRunner.runTest(UsingRuleAsRuleAndClassRule.class);
+    
+    assertThat(result.wasSuccessful()).isTrue();
+    assertThat(UsingRuleAsRuleAndClassRule.staticRule.afterInvoked).isEqualTo(true);
+  }
+
+  public static class SpyRule implements TestRule {
+    boolean beforeClassInvoked;
+    boolean afterClassInvoked;
+    boolean beforeInvoked;
+    boolean afterInvoked;
+    
+    @Override
+    public Statement apply(final Statement base, final Description description) {
+      if (description.isTest()) {
+        return statement(base);
+      } else if (description.isSuite()) {
+        return statementClass(base);
+      }
+      return base;
+    }
+
+    private Statement statement(final Statement base) {
+      return new Statement() {
+        @Override
+        public void evaluate() throws Throwable {
+          before();
+          try {
+            base.evaluate();
+          } finally {
+            after();
+          }
+        }
+      };
+    }
+    
+    private Statement statementClass(final Statement base) {
+      return new Statement() {
+        @Override
+        public void evaluate() throws Throwable {
+          beforeClass();
+          try {
+            base.evaluate();
+          } finally {
+            afterClass();
+          }
+        }
+      };
+    }
+    
+    private void beforeClass() {
+      this.beforeClassInvoked = true;
+    }
+    
+    private void afterClass() {
+      this.afterClassInvoked = true;
+    }
+    
+    private void before() {
+      this.beforeInvoked = true;
+    }
+    
+    private void after() {
+      this.afterInvoked = true;
+    }
+  };
+  
+  public static class UsingRuleAsRuleAndClassRule {
+    @ClassRule
+    public static SpyRule staticRule = new SpyRule();
+    @Rule
+    public SpyRule rule = staticRule;
+    @Test
+    public void doTest() throws Exception {
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableExternalResourceTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableExternalResourceTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableExternalResourceTest.java
new file mode 100755
index 0000000..7b4aa6e
--- /dev/null
+++ b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableExternalResourceTest.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.rules.serializable;
+
+import static org.assertj.core.api.Assertions.*;
+
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+import org.apache.commons.lang.SerializationUtils;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.ExternalResource;
+
+import java.io.Serializable;
+import java.lang.reflect.Field;
+
+/**
+ * Unit tests for {@link SerializableExternalResource}.
+ */
+@Category(UnitTest.class)
+public class SerializableExternalResourceTest {
+
+  @Test
+  public void hasZeroFields() throws Exception {
+    Field[] fields = ExternalResource.class.getDeclaredFields();
+    for (Field field : fields) {
+      //System.out.println("Field: " + field);
+    }
+    assertThat(fields.length).isEqualTo(0);
+  }
+
+  @Test
+  public void isSerializable() throws Exception {
+    assertThat(SerializableExternalResource.class).isInstanceOf(Serializable.class);
+  }
+
+  @Test
+  public void canBeSerialized() throws Throwable {
+    FakeSerializableExternalResource instance = new FakeSerializableExternalResource().value(1);
+
+    FakeSerializableExternalResource cloned = (FakeSerializableExternalResource) SerializationUtils.clone(instance);
+
+    assertThat(instance.value()).isEqualTo(1);
+    assertThat(cloned.value()).isEqualTo(1);
+
+    instance.value(2);
+
+    assertThat(instance.value()).isEqualTo(2);
+    assertThat(cloned.value()).isEqualTo(1);
+  }
+
+  /**
+   * Fake SerializableExternalResource with a simple int field.
+   */
+  private static class FakeSerializableExternalResource extends SerializableExternalResource {
+
+    private int value;
+
+    public FakeSerializableExternalResource value(final int value) {
+      this.value = value;
+      return this;
+    }
+
+    public int value() {
+      return this.value;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableRuleListTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableRuleListTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableRuleListTest.java
new file mode 100755
index 0000000..91c3a25
--- /dev/null
+++ b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableRuleListTest.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.rules.serializable;
+
+import static org.assertj.core.api.Assertions.*;
+
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+import org.apache.commons.lang.SerializationUtils;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+
+import java.io.Serializable;
+
+/**
+ * Unit tests for {@link SerializableRuleList}.
+ */
+@Category(UnitTest.class)
+public class SerializableRuleListTest {
+
+  private String value = "foo";
+
+  @Test
+  public void isSerializable() throws Exception {
+    assertThat(SerializableRuleList.class).isInstanceOf(Serializable.class);
+  }
+
+  @Test
+  public void canBeSerialized() throws Exception {
+    FakeSerializableTestRule fakeRule = new FakeSerializableTestRule().value(this.value);
+    SerializableRuleList instance = new SerializableRuleList().add(fakeRule);
+
+    SerializableRuleList cloned = (SerializableRuleList) SerializationUtils.clone(instance);
+
+    assertThat(cloned.rules().size()).isEqualTo(1);
+    assertThat(cloned.rules().get(0)).isInstanceOf(FakeSerializableTestRule.class).isEqualTo(fakeRule);
+  }
+
+  /**
+   * Fake SerializableTestRule containing a string field and overriding equals.
+   */
+  private static class FakeSerializableTestRule implements SerializableTestRule {
+
+    private String value;
+
+    public FakeSerializableTestRule value(final String value) {
+      this.value = value;
+      return this;
+    }
+
+    public String value() {
+      return this.value;
+    }
+
+    @Override
+    public Statement apply(final Statement base, final Description description) {
+      return new Statement() {
+        @Override
+        public void evaluate() throws Throwable {
+          base.evaluate();
+        }
+      };
+    }
+
+    @Override
+    public boolean equals(Object o) {
+      if (this == o) return true;
+      if (o == null || getClass() != o.getClass()) return false;
+
+      FakeSerializableTestRule that = (FakeSerializableTestRule) o;
+
+      return this.value != null ? this.value.equals(that.value) : that.value == null;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTemporaryFolderTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTemporaryFolderTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTemporaryFolderTest.java
new file mode 100755
index 0000000..10d07b9
--- /dev/null
+++ b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTemporaryFolderTest.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.rules.serializable;
+
+import static com.gemstone.gemfire.test.junit.rules.serializable.FieldSerializationUtils.*;
+import static com.gemstone.gemfire.test.junit.rules.serializable.FieldsOfTemporaryFolder.*;
+import static org.assertj.core.api.Assertions.*;
+
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+import org.apache.commons.lang.SerializationUtils;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TemporaryFolder;
+
+import java.io.File;
+import java.io.Serializable;
+import java.lang.reflect.Field;
+
+/**
+ * Unit tests for {@link SerializableTemporaryFolder}.
+ */
+@Category(UnitTest.class)
+public class SerializableTemporaryFolderTest {
+
+  @Rule
+  public TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+  @Test
+  public void hasTwoFields() throws Exception {
+    Field[] fields = TemporaryFolder.class.getDeclaredFields();
+    for (Field field : fields) {
+      //System.out.println("Field: " + field);
+    }
+    assertThat(fields.length).isEqualTo(2);
+  }
+
+  @Test
+  public void fieldParentFolderShouldExist() throws Exception {
+    Field field = TemporaryFolder.class.getDeclaredField(FIELD_PARENT_FOLDER);
+    assertThat(field.getType()).isEqualTo(File.class);
+  }
+
+  @Test
+  public void fieldFolderShouldExist() throws Exception {
+    Field field = TemporaryFolder.class.getDeclaredField(FIELD_FOLDER);
+    assertThat(field.getType()).isEqualTo(File.class);
+  }
+
+  @Test
+  public void fieldsCanBeRead() throws Exception {
+    File parentFolder = this.temporaryFolder.getRoot();
+
+    SerializableTemporaryFolder instance = new SerializableTemporaryFolder(parentFolder);
+    instance.create();
+
+    assertThat(readField(TemporaryFolder.class, instance, FIELD_PARENT_FOLDER)).isEqualTo(parentFolder);
+    assertThat(readField(TemporaryFolder.class, instance, FIELD_FOLDER)).isEqualTo(instance.getRoot());
+  }
+
+  @Test
+  public void isSerializable() throws Exception {
+    assertThat(SerializableTemporaryFolder.class).isInstanceOf(Serializable.class);
+  }
+
+  @Test
+  public void canBeSerialized() throws Exception {
+    File parentFolder = this.temporaryFolder.getRoot();
+
+    SerializableTemporaryFolder instance = new SerializableTemporaryFolder(parentFolder);
+    instance.create();
+
+    SerializableTemporaryFolder cloned = (SerializableTemporaryFolder)SerializationUtils.clone(instance);
+
+    assertThat(readField(TemporaryFolder.class, cloned, FIELD_PARENT_FOLDER)).isEqualTo(parentFolder);
+    assertThat(readField(TemporaryFolder.class, cloned, FIELD_FOLDER)).isEqualTo(cloned.getRoot());
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestFixtureRuleTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestFixtureRuleTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestFixtureRuleTest.java
new file mode 100755
index 0000000..f1e7004
--- /dev/null
+++ b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestFixtureRuleTest.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.rules.serializable;
+
+import static org.assertj.core.api.Assertions.*;
+
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+import org.apache.commons.lang.SerializationUtils;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.io.Serializable;
+
+/**
+ * Unit tests for {@link SerializableTestFixtureRule}.
+ */
+@Category(UnitTest.class)
+public class SerializableTestFixtureRuleTest {
+
+  @Test
+  public void isSerializable() throws Exception {
+    assertThat(SerializableTestFixtureRule.class).isInstanceOf(Serializable.class);
+  }
+
+  @Test
+  public void canBeSerialized() throws Throwable {
+    FakeSerializableTestFixtureRule instance = new FakeSerializableTestFixtureRule().value(1);
+
+    FakeSerializableTestFixtureRule cloned = (FakeSerializableTestFixtureRule) SerializationUtils.clone(instance);
+
+    assertThat(instance.value()).isEqualTo(1);
+    assertThat(cloned.value()).isEqualTo(1);
+
+    instance.value(2);
+
+    assertThat(instance.value()).isEqualTo(2);
+    assertThat(cloned.value()).isEqualTo(1);
+  }
+
+  /**
+   * Fake SerializableExternalResource with a simple int field.
+   */
+  private static class FakeSerializableTestFixtureRule extends SerializableTestFixtureRule {
+
+    private int value = 0;
+
+    public FakeSerializableTestFixtureRule value(final int value) {
+      this.value = value;
+      return this;
+    }
+
+    public int value() {
+      return this.value;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestNameTest.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestNameTest.java b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestNameTest.java
new file mode 100755
index 0000000..383314c
--- /dev/null
+++ b/gemfire-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestNameTest.java
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.rules.serializable;
+
+import static com.gemstone.gemfire.test.junit.rules.serializable.FieldsOfTestName.*;
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.commons.lang.SerializationUtils;
+import org.junit.Test;
+import org.junit.rules.TestName;
+import org.junit.runner.Description;
+
+import java.io.Serializable;
+import java.lang.reflect.Field;
+
+/**
+ * Unit tests for {@link SerializableTestName}.
+ */
+public class SerializableTestNameTest {
+
+  @Test
+  public void hasOneFields() throws Exception {
+    Field[] fields = TestName.class.getDeclaredFields();
+    for (Field field : fields) {
+      //System.out.println("Field: " + field);
+    }
+    assertThat(fields.length).isEqualTo(1);
+  }
+
+  @Test
+  public void fieldNameShouldExist() throws Exception {
+    Field field = TestName.class.getDeclaredField(FIELD_NAME);
+    assertThat(field.getType()).isEqualTo(String.class);
+  }
+
+  @Test
+  public void fieldsCanBeRead() throws Exception {
+    String name = "foo";
+    Description mockDescription = mock(Description.class);
+    when(mockDescription.getMethodName()).thenReturn(name);
+
+    SerializableTestName instance = new SerializableTestName();
+    instance.starting(mockDescription);
+
+    assertThat(instance.getMethodName()).isEqualTo(name);
+  }
+
+  @Test
+  public void isSerializable() throws Exception {
+    assertThat(SerializableTestName.class).isInstanceOf(Serializable.class);
+  }
+
+  @Test
+  public void canBeSerialized() throws Exception {
+    String name = "bar";
+    Description mockDescription = mock(Description.class);
+    when(mockDescription.getMethodName()).thenReturn(name);
+
+    SerializableTestName instance = new SerializableTestName();
+    instance.starting(mockDescription);
+
+    assertThat(instance.getMethodName()).isEqualTo(name);
+
+    SerializableTestName cloned = (SerializableTestName) SerializationUtils.clone(instance);
+
+    assertThat(cloned.getMethodName()).isEqualTo(name);
+  }
+}



[3/5] incubator-geode git commit: Initial commit with refactored rules

Posted by kl...@apache.org.
Initial commit with refactored rules


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/f2487a46
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/f2487a46
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/f2487a46

Branch: refs/heads/feature/GEODE-953
Commit: f2487a46f4e7152ec3f82a39b7bfed99adafc7bc
Parents: 9899940
Author: Kirk Lund <kl...@pivotal.io>
Authored: Fri Feb 19 16:06:52 2016 -0800
Committer: Kirk Lund <kl...@pivotal.io>
Committed: Fri Feb 19 16:07:38 2016 -0800

----------------------------------------------------------------------
 .../internal/process/PidFileJUnitTest.java      |   4 +-
 .../dunit/rules/DistributedDisconnectRule.java  |  15 +-
 .../rules/DistributedExternalResource.java      |  27 +-
 .../DistributedRestoreSystemProperties.java     |   4 +-
 .../dunit/rules/DistributedTestFixtureRule.java |  57 ++++
 .../gemfire/test/dunit/rules/RemoteInvoker.java |   7 +-
 gemfire-junit/build.gradle                      |   1 +
 .../com/gemstone/gemfire/test/junit/Retry.java  |   4 +-
 .../test/junit/rules/ExpectedTimeout.java       | 180 -----------
 .../gemfire/test/junit/rules/RuleList.java      |  92 ++++++
 .../rules/SerializableExternalResource.java     | 107 -------
 .../test/junit/rules/SerializableRuleChain.java | 119 --------
 .../rules/SerializableTemporaryFolder.java      |  70 -----
 .../test/junit/rules/SerializableTestName.java  |  54 ----
 .../test/junit/rules/SerializableTestRule.java  |  33 --
 .../junit/rules/SerializableTestWatcher.java    |  29 --
 .../test/junit/rules/SerializableTimeout.java   | 119 --------
 .../test/junit/rules/TestFixtureRule.java       | 151 +++++++++
 .../serializable/FieldSerializationUtils.java   |  48 +++
 .../serializable/FieldsOfTemporaryFolder.java   |  26 ++
 .../rules/serializable/FieldsOfTestName.java    |  24 ++
 .../rules/serializable/FieldsOfTimeout.java     |  26 ++
 .../SerializableExternalResource.java           |  25 ++
 .../serializable/SerializableRuleList.java      |  78 +++++
 .../SerializableTemporaryFolder.java            |  71 +++++
 .../SerializableTestFixtureRule.java            |  25 ++
 .../serializable/SerializableTestName.java      |  65 ++++
 .../serializable/SerializableTestRule.java      |  31 ++
 .../serializable/SerializableTestWatcher.java   |  26 ++
 .../rules/serializable/SerializableTimeout.java | 108 +++++++
 .../junit/rules/ExpectedTimeoutJUnitTest.java   | 204 -------------
 .../junit/rules/ExpectedTimeoutRuleTest.java    | 212 +++++++++++++
 .../test/junit/rules/IgnoreUntilRuleTest.java   | 119 ++++++++
 .../test/junit/rules/RepeatRuleTest.java        | 302 ++++++++++++++++++
 .../rules/RetryRuleGlobalWithErrorTest.java     | 249 +++++++++++++++
 .../rules/RetryRuleGlobalWithExceptionTest.java | 253 +++++++++++++++
 .../rules/RetryRuleLocalWithErrorTest.java      | 206 +++++++++++++
 .../rules/RetryRuleLocalWithExceptionTest.java  | 214 +++++++++++++
 .../gemfire/test/junit/rules/TestRunner.java    |  37 +++
 .../rules/examples/RetryRuleExampleTest.java    |   8 +-
 .../rules/examples/RuleAndClassRuleTest.java    | 140 +++++++++
 .../SerializableExternalResourceTest.java       |  81 +++++
 .../serializable/SerializableRuleListTest.java  |  90 ++++++
 .../SerializableTemporaryFolderTest.java        |  92 ++++++
 .../SerializableTestFixtureRuleTest.java        |  70 +++++
 .../serializable/SerializableTestNameTest.java  |  83 +++++
 .../SerializableTestWatcherTest.java            |  81 +++++
 .../serializable/SerializableTimeoutTest.java   | 104 +++++++
 .../rules/tests/ExpectedTimeoutRuleTest.java    | 214 -------------
 .../junit/rules/tests/IgnoreUntilRuleTest.java  | 121 --------
 .../junit/rules/tests/JUnitRuleTestSuite.java   |  33 --
 .../test/junit/rules/tests/RepeatRuleTest.java  | 304 -------------------
 .../tests/RetryRuleGlobalWithErrorTest.java     | 250 ---------------
 .../tests/RetryRuleGlobalWithExceptionTest.java | 254 ----------------
 .../tests/RetryRuleLocalWithErrorTest.java      | 207 -------------
 .../tests/RetryRuleLocalWithExceptionTest.java  | 213 -------------
 .../junit/rules/tests/RuleAndClassRuleTest.java | 138 ---------
 .../test/junit/rules/tests/TestRunner.java      |  37 ---
 58 files changed, 3216 insertions(+), 2726 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-core/src/test/java/com/gemstone/gemfire/internal/process/PidFileJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/process/PidFileJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/process/PidFileJUnitTest.java
index 5f81c2b..2906b0e 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/process/PidFileJUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/process/PidFileJUnitTest.java
@@ -42,7 +42,7 @@ import org.junit.rules.TemporaryFolder;
 
 import com.gemstone.gemfire.internal.util.StopWatch;
 import com.gemstone.gemfire.test.junit.categories.UnitTest;
-import com.gemstone.gemfire.test.junit.rules.ExpectedTimeout;
+import com.gemstone.gemfire.test.junit.rules.ExpectedTimeoutRule;
 
 /**
  * Unit tests the PidFile class.
@@ -60,7 +60,7 @@ public class PidFileJUnitTest {
   public ExpectedException thrown = ExpectedException.none();
   
   @Rule
-  public ExpectedTimeout timeout = ExpectedTimeout.none();
+  public ExpectedTimeoutRule timeout = ExpectedTimeoutRule.none();
   
   protected Mockery mockContext;
   private ExecutorService futures;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/DistributedDisconnectRule.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/DistributedDisconnectRule.java b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/DistributedDisconnectRule.java
index 125fc06..f7a5179 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/DistributedDisconnectRule.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/DistributedDisconnectRule.java
@@ -16,12 +16,15 @@
  */
 package com.gemstone.gemfire.test.dunit.rules;
 
-// TODO: import static com.gemstone.gemfire.test.dunit.DistributedTestRule.*;
+// TODO:uncomment: import static com.gemstone.gemfire.test.dunit.DistributedTestRule.*;
 
 import com.gemstone.gemfire.test.dunit.SerializableRunnable;
 
+/**
+ * Disconnects all remote DUnit JVMs including the Locator JVM.
+ */
 @SuppressWarnings("serial")
-public class DistributedDisconnectRule extends DistributedExternalResource {
+public class DistributedDisconnectRule extends DistributedTestFixtureRule {
 
   private final boolean disconnectBefore;
   private final boolean disconnectAfter;
@@ -52,7 +55,7 @@ public class DistributedDisconnectRule extends DistributedExternalResource {
   }
 
   @Override
-  protected void after() throws Throwable {
+  protected void after() {
     if (this.disconnectAfter) {
       invoker().invokeEverywhere(serializableRunnable());
     }
@@ -66,7 +69,7 @@ public class DistributedDisconnectRule extends DistributedExternalResource {
   }
 
   @Override
-  protected void afterClass() throws Throwable {
+  protected void afterClass() {
     if (this.disconnectAfterClass) {
       invoker().invokeEverywhere(serializableRunnable());
     }
@@ -76,15 +79,13 @@ public class DistributedDisconnectRule extends DistributedExternalResource {
     return new SerializableRunnable() {
       @Override
       public void run() {
-        // TODO: disconnectFromDS();
+        // TODO:uncomment: disconnectFromDS();
       }
     };
   }
   
   /**
    * Builds an instance of DistributedDisconnectRule
-   * 
-   * @author Kirk Lund
    */
   public static class Builder {
     private boolean disconnectBeforeClass;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/DistributedExternalResource.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/DistributedExternalResource.java b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/DistributedExternalResource.java
index d3b7319..a7c3598 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/DistributedExternalResource.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/DistributedExternalResource.java
@@ -16,9 +16,12 @@
  */
 package com.gemstone.gemfire.test.dunit.rules;
 
-import com.gemstone.gemfire.test.junit.rules.SerializableExternalResource;
+import com.gemstone.gemfire.test.junit.rules.serializable.SerializableExternalResource;
 
-@SuppressWarnings("serial")
+/**
+ * Distributed version of SerializableExternalResource which affects all remote
+ * DUnit JVMs including the Locator JVM.
+ */
 public class DistributedExternalResource extends SerializableExternalResource {
 
   private final RemoteInvoker invoker;
@@ -35,24 +38,4 @@ public class DistributedExternalResource extends SerializableExternalResource {
   protected RemoteInvoker invoker() {
     return this.invoker;
   }
-  
-  @Override
-  protected void before() throws Throwable {
-    // do nothing
-  }
-
-  @Override
-  protected void after() throws Throwable {
-    // do nothing
-  }
-
-  @Override
-  protected void beforeClass() throws Throwable {
-    // do nothing
-  }
-
-  @Override
-  protected void afterClass() throws Throwable {
-    // do nothing
-  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/DistributedRestoreSystemProperties.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/DistributedRestoreSystemProperties.java b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/DistributedRestoreSystemProperties.java
index 1711b21..061cb42 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/DistributedRestoreSystemProperties.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/DistributedRestoreSystemProperties.java
@@ -24,13 +24,11 @@ import java.util.Properties;
 import org.junit.contrib.java.lang.system.RestoreSystemProperties;
 
 import com.gemstone.gemfire.test.dunit.SerializableRunnable;
-import com.gemstone.gemfire.test.junit.rules.SerializableTestRule;
+import com.gemstone.gemfire.test.junit.rules.serializable.SerializableTestRule;
 
 /**
  * Distributed version of RestoreSystemProperties which affects all DUnit 
  * JVMs including the Locator JVM.
- * 
- * @author Kirk Lund
  */
 @SuppressWarnings("serial")
 public class DistributedRestoreSystemProperties extends RestoreSystemProperties implements SerializableTestRule {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/DistributedTestFixtureRule.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/DistributedTestFixtureRule.java b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/DistributedTestFixtureRule.java
new file mode 100755
index 0000000..86e93f3
--- /dev/null
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/DistributedTestFixtureRule.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.dunit.rules;
+
+import com.gemstone.gemfire.test.junit.rules.serializable.SerializableTestFixtureRule;
+
+/**
+ * Distributed version of SerializableTestFixtureRule which affects all
+ * DUnit JVMs including the Locator JVM. TODO: make which JVMs configurable
+ */
+public class DistributedTestFixtureRule extends SerializableTestFixtureRule {
+
+  private final RemoteInvoker invoker;
+
+  public DistributedTestFixtureRule() {
+    this(new RemoteInvoker());
+  }
+
+  public DistributedTestFixtureRule(final RemoteInvoker invoker) {
+    super();
+    this.invoker = invoker;
+  }
+
+  protected RemoteInvoker invoker() {
+    return this.invoker;
+  }
+
+  @Override
+  protected void before() throws Throwable {
+  }
+
+  @Override
+  protected void after() {
+  }
+
+  @Override
+  protected void beforeClass() throws Throwable {
+  }
+
+  @Override
+  protected void afterClass() {
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/RemoteInvoker.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/RemoteInvoker.java b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/RemoteInvoker.java
index 9e3c5b2..278250b 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/RemoteInvoker.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/RemoteInvoker.java
@@ -23,8 +23,13 @@ import java.io.Serializable;
 
 import com.gemstone.gemfire.test.dunit.SerializableRunnable;
 
+/**
+ * Provides remote invocation support to a <code>TestRule</code>. These
+ * methods will invoke a SerializableRunnable in all remote DUnit JVMs
+ * including the Locator JVM.
+ */
 @SuppressWarnings("serial")
-public class RemoteInvoker implements Serializable {
+class RemoteInvoker implements Serializable {
 
   public void invokeEverywhere(final SerializableRunnable runnable) {
     try {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/build.gradle
----------------------------------------------------------------------
diff --git a/gemfire-junit/build.gradle b/gemfire-junit/build.gradle
index 112d112..7aa6562 100755
--- a/gemfire-junit/build.gradle
+++ b/gemfire-junit/build.gradle
@@ -16,6 +16,7 @@
  */
 
 dependencies {
+  testCompile 'commons-lang:commons-lang:' + project.'commons-lang.version'
   compile 'junit:junit:' + project.'junit.version'
   compile 'org.hamcrest:hamcrest-all:' + project.'hamcrest-all.version'
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/Retry.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/Retry.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/Retry.java
index 65f3cf6..6039943 100755
--- a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/Retry.java
+++ b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/Retry.java
@@ -23,8 +23,8 @@ import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
 
 /**
- * Java Annotation used to annotate a test suite class test case method in order to
- * retry it in case of failure up to the specified maximum attempts.
+ * Java Annotation used to annotate a test method in order to retry failures
+ * up to the specified maximum attempts. Default maximum attempts is one retry.
  */
 @Documented
 @Retention(RetentionPolicy.RUNTIME)

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/ExpectedTimeout.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/ExpectedTimeout.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/ExpectedTimeout.java
deleted file mode 100755
index 2f53811..0000000
--- a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/ExpectedTimeout.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.test.junit.rules;
-
-import static org.junit.Assert.assertThat;
-
-import java.util.concurrent.TimeUnit;
-
-import org.hamcrest.Matcher;
-import org.junit.rules.ExpectedException;
-import org.junit.rules.TestRule;
-import org.junit.runner.Description;
-import org.junit.runners.model.Statement;
-
-/**
- * Expect an Exception within a specified timeout.
- * 
- * @author Kirk Lund
- * @since 8.2
- */
-public class ExpectedTimeout implements TestRule {
-
-  /**
-   * @return a Rule that expects no timeout (identical to behavior without this Rule)
-   */
-  public static ExpectedTimeout none() {
-    return new ExpectedTimeout();
-  }
-  
-  private ExpectedException delegate;
-  private boolean expectsThrowable;
-  private long minDuration;
-  private long maxDuration;
-  private TimeUnit timeUnit;
-  
-  private ExpectedTimeout() {
-    this.delegate = ExpectedException.none();
-  }
-
-  public ExpectedTimeout expectMinimumDuration(final long minDuration) {
-    this.minDuration = minDuration;
-    return this;
-  }
-  public ExpectedTimeout expectMaximumDuration(final long maxDuration) {
-    this.maxDuration = maxDuration;
-    return this;
-  }
-  public ExpectedTimeout expectTimeUnit(final TimeUnit timeUnit) {
-    this.timeUnit = timeUnit;
-    return this;
-  }
-
-  public ExpectedTimeout handleAssertionErrors() {
-    this.delegate.handleAssertionErrors();
-    return this;
-  }
-  
-  public ExpectedTimeout handleAssumptionViolatedExceptions() {
-    this.delegate.handleAssumptionViolatedExceptions();
-    return this;
-  }
-  
-  /**
-   * Adds {@code matcher} to the list of requirements for any thrown
-   * exception.
-   */
-  public void expect(final Matcher<?> matcher) {
-    this.delegate.expect(matcher);
-  }
-
-  /**
-   * Adds to the list of requirements for any thrown exception that it should
-   * be an instance of {@code type}
-   */
-  public void expect(final Class<? extends Throwable> type) {
-    this.delegate.expect(type);
-    this.expectsThrowable = true;
-  }
-
-  /**
-   * Adds to the list of requirements for any thrown exception that it should
-   * <em>contain</em> string {@code substring}
-   */
-  public void expectMessage(final String substring) {
-    this.delegate.expectMessage(substring);
-  }
-
-  /**
-   * Adds {@code matcher} to the list of requirements for the message returned
-   * from any thrown exception.
-   */
-  public void expectMessage(final Matcher<String> matcher) {
-    this.delegate.expectMessage(matcher);
-  }
-
-  /**
-   * Adds {@code matcher} to the list of requirements for the cause of
-   * any thrown exception.
-   */
-  public void expectCause(final Matcher<? extends Throwable> expectedCause) {
-    this.delegate.expectCause(expectedCause);
-  }
-
-  public boolean expectsTimeout() {
-    return minDuration > 0 || maxDuration > 0;
-  }
-  
-  public boolean expectsThrowable() {
-    return expectsThrowable = true;
-  }
-  
-  @Override
-  public Statement apply(final Statement base, final Description description) {
-    Statement next = delegate.apply(base, description);
-    return new ExpectedTimeoutStatement(next);
-  }
-  
-  private void handleTime(final Long duration) {
-    if (expectsTimeout()) {
-      assertThat(timeUnit.convert(duration, TimeUnit.NANOSECONDS), new TimeMatcher(timeUnit, minDuration, maxDuration));
-    }
-  }
-  
-  private static class TimeMatcher extends org.hamcrest.TypeSafeMatcher<Long> {
-    
-    private final TimeUnit timeUnit;
-    private final long minDuration;
-    private final long maxDuration;
- 
-    public TimeMatcher(final TimeUnit timeUnit, final long minDuration, final long maxDuration) {
-      this.timeUnit = timeUnit;
-      this.minDuration = minDuration;
-      this.maxDuration = maxDuration;
-    }
- 
-    @Override
-    public boolean matchesSafely(final Long duration) {
-      return duration >= this.minDuration && duration <= this.maxDuration;
-    }
-
-    @Override
-    public void describeTo(final org.hamcrest.Description description) {
-      description.appendText("expects duration to be greater than or equal to ")
-          .appendValue(this.minDuration)
-          .appendText(" and less than or equal to ")
-          .appendValue(this.maxDuration)
-          .appendText(" ")
-          .appendValue(this.timeUnit);
-    }
-  }
-  
-  private class ExpectedTimeoutStatement extends Statement {
-    private final Statement next;
-
-    public ExpectedTimeoutStatement(final Statement base) {
-      next = base;
-    }
-
-    @Override
-    public void evaluate() throws Throwable {
-      long start = System.nanoTime();
-      next.evaluate();
-      handleTime(System.nanoTime() - start);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/RuleList.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/RuleList.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/RuleList.java
new file mode 100755
index 0000000..08446b0
--- /dev/null
+++ b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/RuleList.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.rules;
+
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * The {@code RuleList} rule enables ordering of TestRules.
+ *
+ * <p>Example:
+ *
+ * <pre>
+ * public class SomeTest {
+ *
+ *   \@Rule
+ *   public RuleList rules = new RuleList().add(new FirstRule()
+ *                                         .add(new SecondRule()
+ *                                         .add(new ThirdRule();
+ * </pre>
+ *
+ * @author Kirk Lund
+ */
+public class RuleList implements TestRule {
+  
+  private final List<TestRule> rules = new ArrayList<>();
+
+  /**
+   * Creates an empty {@code RuleList}.
+   */
+  public RuleList() {
+  }
+
+  /**
+   * Creates a {@code RuleList} containing a single {@link TestRule}.
+   *
+   * @param rule the first rule of the {@code RuleList}
+   */
+  public RuleList(final TestRule rule) {
+    this.rules.add(rule);
+  }
+
+  /**
+   * Creates a new {@code RuleList} containing the specified {@link TestRule}s.
+   *
+   * @param rules the list of {@code TestRule}s to add
+   */
+  protected RuleList(final List<TestRule> rules) {
+    this.rules.addAll(rules);
+  }
+
+  /**
+   * Adds a new {@code TestRule} to the end of the current {@code RuleList}.
+   *
+   * @param rule the rule to add.
+   * @return the {@code RuleList} with a new TestRule added
+   */
+  public RuleList add(final TestRule rule) {
+    this.rules.add(rule);
+    return this;
+  }
+
+  @Override
+  public Statement apply(Statement base, final Description description) {
+    for (TestRule each : this.rules) {
+      base = each.apply(base, description);
+    }
+    return base;
+  }
+
+  protected List<TestRule> rules() {
+    return new ArrayList<>(this.rules);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/SerializableExternalResource.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/SerializableExternalResource.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/SerializableExternalResource.java
deleted file mode 100755
index 37d8eb5..0000000
--- a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/SerializableExternalResource.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.test.junit.rules;
-
-import org.junit.runner.Description;
-import org.junit.runners.model.Statement;
-
-/**
- * Serializable version of ExternalResource JUnit Rule. JUnit lifecycle is not
- * executed in remote JVMs. The <tt>after()</tt> callback has a throws-clause 
- * that matches <tt>before()</tt>.
- * 
- * Implementation copied from <tt>org.junit.rules.ExternalResource</tt>.
- * 
- * @author Kirk Lund
- */
-@SuppressWarnings("serial")
-public abstract class SerializableExternalResource implements SerializableTestRule {
-  
-  @Override
-  public Statement apply(final Statement base, final Description description) {
-    if (description.isTest()) {
-      return statement(base);
-    } else if (description.isSuite()) {
-      return statementClass(base);
-    }
-    return base;
-  }
-
-  private Statement statement(final Statement base) {
-    return new Statement() {
-      @Override
-      public void evaluate() throws Throwable {
-        before();
-        try {
-          base.evaluate();
-        } finally {
-          after();
-        }
-      }
-    };
-  }
-
-  private Statement statementClass(final Statement base) {
-    return new Statement() {
-      @Override
-      public void evaluate() throws Throwable {
-        beforeClass();
-        try {
-          base.evaluate();
-        } finally {
-          afterClass();
-        }
-      }
-    };
-  }
-
-  /**
-   * Override to set up your specific external resource.
-   *
-   * @throws Throwable if setup fails (which will disable {@code after}
-   */
-  protected void before() throws Throwable {
-    // do nothing
-  }
-
-  /**
-   * Override to tear down your specific external resource.
-   * 
-   * @throws Throwable if teardown fails (which will disable {@code after}
-   */
-  protected void after() throws Throwable {
-    // do nothing
-  }
-
-  /**
-   * Override to set up your specific external resource.
-   *
-   * @throws Throwable if setup fails (which will disable {@code after}
-   */
-  protected void beforeClass() throws Throwable {
-    // do nothing
-  }
-
-  /**
-   * Override to tear down your specific external resource.
-   *
-   * @throws Throwable if teardown fails (which will disable {@code after}
-   */
-  protected void afterClass() throws Throwable {
-    // do nothing
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/SerializableRuleChain.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/SerializableRuleChain.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/SerializableRuleChain.java
deleted file mode 100755
index 936345e..0000000
--- a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/SerializableRuleChain.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.test.junit.rules;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.junit.rules.TestRule;
-import org.junit.runner.Description;
-import org.junit.runners.model.Statement;
-
-/**
- * Serializable version of TemporaryFolder JUnit Rule. JUnit lifecycle is not
- * executed in remote JVMs.
- * 
- * Implementation copied from <tt>org.junit.rules.RuleChain</tt>.
- * 
- * The SerializableRuleChain rule allows ordering of TestRules. You create a
- * {@code RuleChain} with {@link #outerRule(TestRule)} and subsequent calls of
- * {@link #around(TestRule)}:
- *
- * <pre>
- * public static class UseRuleChain {
- *  &#064;Rule
- *  public RuleChain chain= RuleChain
- *                         .outerRule(new LoggingRule("outer rule")
- *                         .around(new LoggingRule("middle rule")
- *                         .around(new LoggingRule("inner rule");
- *
- *  &#064;Test
- *  public void example() {
- *    assertTrue(true);
- *     }
- * }
- * </pre>
- *
- * writes the log
- *
- * <pre>
- * starting outer rule
- * starting middle rule
- * starting inner rule
- * finished inner rule
- * finished middle rule
- * finished outer rule
- * </pre>
- *
- * @author Kirk Lund
- */
-@SuppressWarnings("serial")
-public class SerializableRuleChain implements SerializableTestRule {
-  private static final SerializableRuleChain EMPTY_CHAIN = new SerializableRuleChain(Collections.<TestRule>emptyList());
-
-  private transient List<TestRule> rulesStartingWithInnerMost;
-
-  /**
-  * Returns a {@code SerializableRuleChain} without a {@link TestRule}. This method may
-  * be the starting point of a {@code SerializableRuleChain}.
-  *
-  * @return a {@code SerializableRuleChain} without a {@link TestRule}.
-  */
-  public static SerializableRuleChain emptyRuleChain() {
-    return EMPTY_CHAIN;
-  }
-
-  /**
-  * Returns a {@code SerializableRuleChain} with a single {@link TestRule}. This method
-  * is the usual starting point of a {@code SerializableRuleChain}.
-  *
-  * @param outerRule the outer rule of the {@code SerializableRuleChain}.
-  * @return a {@code SerializableRuleChain} with a single {@link TestRule}.
-  */
-  public static SerializableRuleChain outerRule(TestRule outerRule) {
-    return emptyRuleChain().around(outerRule);
-  }
-
-  private SerializableRuleChain(List<TestRule> rules) {
-    this.rulesStartingWithInnerMost = rules;
-  }
-
-  /**
-  * Create a new {@code SerializableRuleChain}, which encloses the {@code nextRule} with
-  * the rules of the current {@code SerializableRuleChain}.
-  *
-  * @param enclosedRule the rule to enclose.
-  * @return a new {@code SerializableRuleChain}.
-  */
-  public SerializableRuleChain around(TestRule enclosedRule) {
-    List<TestRule> rulesOfNewChain = new ArrayList<TestRule>();
-    rulesOfNewChain.add(enclosedRule);
-    rulesOfNewChain.addAll(rulesStartingWithInnerMost);
-    return new SerializableRuleChain(rulesOfNewChain);
-  }
-
-  /**
-  * {@inheritDoc}
-  */
-  public Statement apply(Statement base, Description description) {
-    for (TestRule each : rulesStartingWithInnerMost) {
-      base = each.apply(base, description);
-    }
-    return base;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/SerializableTemporaryFolder.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/SerializableTemporaryFolder.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/SerializableTemporaryFolder.java
deleted file mode 100755
index 0e796b3..0000000
--- a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/SerializableTemporaryFolder.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.test.junit.rules;
-
-import java.io.File;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.lang.reflect.Field;
-
-import org.junit.rules.TemporaryFolder;
-
-/**
- * Serializable version of TemporaryFolder JUnit Rule. JUnit lifecycle is not
- * executed in remote JVMs.
- * 
- * @author Kirk Lund
- */
-@SuppressWarnings("serial")
-public class SerializableTemporaryFolder extends TemporaryFolder implements SerializableTestRule {
-
-  private void writeObject(final ObjectOutputStream out) throws Exception {
-    writeParentFolder(out);
-    writeFolder(out);
-  }
-
-  private void readObject(final ObjectInputStream in) throws Exception {
-    readParentFolder(in);
-    readFolder(in);
-  }
-  
-  private void readParentFolder(final ObjectInputStream in) throws Exception {
-    final Field parentFolderField = TemporaryFolder.class.getDeclaredField("parentFolder");
-    parentFolderField.setAccessible(true);
-    parentFolderField.set(this, (File) in.readObject());
-  }
-  
-  private void readFolder(final ObjectInputStream in) throws Exception {
-    final Field folderField = TemporaryFolder.class.getDeclaredField("folder");
-    folderField.setAccessible(true);
-    folderField.set(this, (File) in.readObject());
-  }
-  
-  private void writeParentFolder(final ObjectOutputStream out) throws Exception {
-    final Field parentFolderField = TemporaryFolder.class.getDeclaredField("parentFolder");
-    parentFolderField.setAccessible(true);
-    final File parentFolderFieldValue = (File) parentFolderField.get(this);
-    out.writeObject(parentFolderFieldValue);
-  }
-  
-  private void writeFolder(final ObjectOutputStream out) throws Exception {
-    final Field folderField = TemporaryFolder.class.getDeclaredField("folder");
-    folderField.setAccessible(true);
-    final File folderFieldValue = (File) folderField.get(this);
-    out.writeObject(folderFieldValue);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/SerializableTestName.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/SerializableTestName.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/SerializableTestName.java
deleted file mode 100755
index 1fd255f..0000000
--- a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/SerializableTestName.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.test.junit.rules;
-
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.lang.reflect.Field;
-
-import org.junit.rules.TestName;
-
-/**
- * Serializable version of TestName JUnit Rule. JUnit lifecycle is not
- * executed in remote JVMs.
- * 
- * @author Kirk Lund
- */
-@SuppressWarnings("serial")
-public class SerializableTestName extends TestName implements SerializableTestRule {
-
-  private void writeObject(final ObjectOutputStream out) throws Exception {
-    writeName(out);
-  }
-
-  private void readObject(final ObjectInputStream in) throws Exception {
-    readName(in);
-  }
-  
-  private void writeName(final ObjectOutputStream out) throws Exception {
-    final Field nameField = TestName.class.getDeclaredField("name");
-    nameField.setAccessible(true);
-    final String nameValue = (String) nameField.get(this);
-    out.writeObject(nameValue);
-  }
-  
-  private void readName(final ObjectInputStream in) throws Exception {
-    Field nameField = TestName.class.getDeclaredField("name");
-    nameField.setAccessible(true);
-    nameField.set(this, (String) in.readObject());
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/SerializableTestRule.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/SerializableTestRule.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/SerializableTestRule.java
deleted file mode 100755
index 354c38a..0000000
--- a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/SerializableTestRule.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.test.junit.rules;
-
-import java.io.Serializable;
-
-import org.junit.rules.TestRule;
-
-/**
- * Serializable version of JUnit TestRule. JUnit lifecycle is not
- * executed in remote JVMs.
- * 
- * The simplest way to satisfy this interface is to apply <tt>transient</tt>
- * to every instance field.
- * 
- * @author Kirk Lund
- */
-public interface SerializableTestRule extends Serializable, TestRule {
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/SerializableTestWatcher.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/SerializableTestWatcher.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/SerializableTestWatcher.java
deleted file mode 100755
index 5bcf686..0000000
--- a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/SerializableTestWatcher.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.test.junit.rules;
-
-import org.junit.rules.TestWatcher;
-
-/**
- * Serializable version of TestWatcher JUnit Rule. JUnit lifecycle is not
- * executed in remote JVMs.
- * 
- * @author Kirk Lund
- */
-@SuppressWarnings("serial")
-public class SerializableTestWatcher extends TestWatcher implements SerializableTestRule {
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/SerializableTimeout.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/SerializableTimeout.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/SerializableTimeout.java
deleted file mode 100755
index 3136a1c..0000000
--- a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/SerializableTimeout.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.test.junit.rules;
-
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.lang.reflect.Field;
-import java.util.concurrent.TimeUnit;
-
-import org.junit.rules.TemporaryFolder;
-import org.junit.rules.TestName;
-import org.junit.rules.Timeout;
-
-/**
- * Serializable version of Timeout JUnit Rule. JUnit lifecycle is not
- * executed in remote JVMs.
- * 
- * @author Kirk Lund
- */
-@SuppressWarnings("serial")
-public class SerializableTimeout extends Timeout implements SerializableTestRule {
-
-  public static Builder builder() {
-    return new Builder();
-  }
-  
-  public SerializableTimeout(final long timeout, final TimeUnit timeUnit) {
-    super(timeout, timeUnit);
-  }
-  
-  protected SerializableTimeout(final Builder builder) {
-    super(builder);
-  }
-  
-  public static class Builder extends Timeout.Builder {
-    
-    protected Builder() {
-      super();
-    }
-    
-    @Override
-    public SerializableTimeout build() {
-      return new SerializableTimeout(this);
-    }
-  }
-
-  private void writeObject(final ObjectOutputStream out) throws Exception {
-    writeTimeout(out);
-    writeTimeUnit(out);
-    writeLookForStuckThread(out);
-  }
-
-  private void readObject(final ObjectInputStream in) throws Exception {
-    readTimeout(in);
-    readTimeUnit(in);
-    readLookForStuckThread(in);
-  }
-  
-  private void writeTimeout(final ObjectOutputStream out) throws Exception {
-    final Field timeoutField = TestName.class.getDeclaredField("timeout");
-    timeoutField.setAccessible(true);
-    final Long timeoutValue = (Long) timeoutField.get(this);
-    out.writeLong(timeoutValue);
-  }
-  
-  private void writeTimeUnit(final ObjectOutputStream out) throws Exception {
-    final Field timeoutField = TestName.class.getDeclaredField("timeUnit");
-    timeoutField.setAccessible(true);
-    final TimeUnit timeoutValue = (TimeUnit) timeoutField.get(this);
-    out.writeObject(timeoutValue);
-  }
-
-  private void writeLookForStuckThread(final ObjectOutputStream out) throws Exception {
-    try {
-      final Field lookForStuckThreadField = TemporaryFolder.class.getDeclaredField("lookForStuckThread");
-      lookForStuckThreadField.setAccessible(true);
-      final Boolean lookForStuckThreadValue = (Boolean) lookForStuckThreadField.get(this);
-      out.writeBoolean(lookForStuckThreadValue);
-    } catch (NoSuchFieldException e) {
-      out.writeBoolean(false);
-    }
-  }
-  
-  private void readTimeout(final ObjectInputStream in) throws Exception {
-    Field timeoutField = TestName.class.getDeclaredField("timeout");
-    timeoutField.setAccessible(true);
-    timeoutField.set(this, (Long) in.readObject());
-  }
-
-  private void readTimeUnit(final ObjectInputStream in) throws Exception {
-    Field timeUnitField = TestName.class.getDeclaredField("timeUnit");
-    timeUnitField.setAccessible(true);
-    timeUnitField.set(this, (TimeUnit) in.readObject());
-  }
-
-  private void readLookForStuckThread(final ObjectInputStream in) throws Exception {
-    try {
-      final Field lookForStuckThreadField = TemporaryFolder.class.getDeclaredField("lookForStuckThread");
-      lookForStuckThreadField.setAccessible(true);
-      lookForStuckThreadField.set(this, (Boolean) in.readObject());
-    } catch (NoSuchFieldException e) {
-      final boolean value = (Boolean) in.readObject();
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/TestFixtureRule.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/TestFixtureRule.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/TestFixtureRule.java
new file mode 100755
index 0000000..21e5eb9
--- /dev/null
+++ b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/TestFixtureRule.java
@@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.rules;
+
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+
+/**
+ * An abstract base class for test rules that combine {@code ClassRule} and
+ * method {@code Rule} test fixture lifecycle callbacks. Subclasses may
+ * override any or all of these methods:
+ * <p><ul>
+ * <li></li>{@link #beforeClass()}
+ * <li></li>{@link #afterClass()}
+ * <li></li>{@link #before()}
+ * <li></li>{@link #after()}
+ * </ul>
+ *
+ * <p>The rule variable does not have to be static in order to implement
+ * {@link #beforeClass()} and {@link #afterClass()}.
+ *
+ * <p>Example:
+ *
+ * <pre>
+ * public class SomeTest {
+ *
+ *   \@Rule
+ *   public TestFixtureRule testFixtureRule = new TestFixtureRule() {
+ *     \@Override
+ *     protected void beforeClass() throws Throwable {
+ *       // setup executed once before all tests in SomeTest
+ *     }
+ *     \@Override
+ *     protected void afterClass() {
+ *       // teardown executed once after all tests in SomeTest
+ *     }
+ *     \@Override
+ *     protected void before() throws Throwable {
+ *       // setup executed before each test in SomeTest
+ *     }
+ *     \@Override
+ *     protected void after() {
+ *       // teardown executed after each test in SomeTest
+ *     }
+ *   }
+ * }
+ * </pre>
+ *
+ * @author Kirk Lund
+ */
+public class TestFixtureRule implements TestRule {
+
+  @Override
+  public Statement apply(final Statement base, final Description description) {
+    if (description.isSuite()) {
+      return createClassStatement(base);
+    } else if (description.isTest()) {
+      return createMethodStatement(base);
+    }
+    return base;
+  }
+
+  /**
+   * Returns new <code>Statement</code> for invoking <code>beforeClass</code>
+   * and <code>afterClass</code>.
+   */
+  protected Statement createClassStatement(final Statement base) {
+    return new Statement() {
+      @Override
+      public void evaluate() throws Throwable {
+        beforeClass();
+        try {
+          base.evaluate();
+        } finally {
+          afterClass();
+        }
+      }
+    };
+  }
+
+  /**
+   * Returns new <code>Statement</code> for invoking <code>before</code>
+   * and <code>after</code>.
+   */
+  protected Statement createMethodStatement(final Statement base) {
+    return new Statement() {
+      @Override
+      public void evaluate() throws Throwable {
+        before();
+        try {
+          base.evaluate();
+        } finally {
+          after();
+        }
+      }
+    };
+  }
+
+  /**
+   * Override to perform custom setup during <code>beforeClass</code> which
+   * is invoked prior to {@link #before()} and all test methods.
+   *
+   * If any <code>Throwable</code> is thrown, then <code>afterClass</code> will
+   * be disabled.
+   *
+   * @throws Throwable if setup fails
+   */
+  protected void beforeClass() throws Throwable {
+  }
+
+  /**
+   * Override to perform custom tearDown during <code>afterClass</code> which
+   * is invoked following {@link #after()} and all test methods.
+   */
+  protected void afterClass() {
+  }
+
+  /**
+   * Override to perform custom setup before each test method.
+   *
+   * If any <code>Throwable</code> is thrown, then <code>after</code> will
+   * be disabled.
+   *
+   * @throws Throwable if setup fails
+   */
+  protected void before() throws Throwable {
+    // do nothing
+  }
+
+  /**
+   * Override to perform custom tearDown during after each test method.
+   */
+  protected void after() {
+    // do nothing
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/FieldSerializationUtils.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/FieldSerializationUtils.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/FieldSerializationUtils.java
new file mode 100755
index 0000000..97e9265
--- /dev/null
+++ b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/FieldSerializationUtils.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.rules.serializable;
+
+import java.lang.reflect.Field;
+
+/**
+ * Provides support for serialization of private fields by reflection.
+ */
+public class FieldSerializationUtils {
+
+  protected FieldSerializationUtils() {
+  }
+
+  public static Object readField(final Class targetClass, final Object targetInstance, final String fieldName) {
+    try {
+      Field assureDeletionField = targetClass.getDeclaredField(fieldName);
+      assureDeletionField.setAccessible(true);
+      return assureDeletionField.get(targetInstance);
+    } catch (IllegalAccessException | NoSuchFieldException e) {
+      throw new Error(e);
+    }
+  }
+
+  public static void writeField(final Class targetClass, final Object targetInstance, final String fieldName, final Object value) {
+    try {
+      Field folderField = targetClass.getDeclaredField(fieldName);
+      folderField.setAccessible(true);
+      folderField.set(targetInstance, value);
+    } catch (IllegalAccessException | NoSuchFieldException e) {
+      throw new Error(e);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/FieldsOfTemporaryFolder.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/FieldsOfTemporaryFolder.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/FieldsOfTemporaryFolder.java
new file mode 100755
index 0000000..3dd5ebd
--- /dev/null
+++ b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/FieldsOfTemporaryFolder.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.rules.serializable;
+
+/**
+ * Names of member fields in {@link org.junit.rules.TemporaryFolder}.
+ */
+interface FieldsOfTemporaryFolder {
+  static final String FIELD_PARENT_FOLDER = "parentFolder"; // java.io.File
+  static final String FIELD_ASSURE_DELETION = "assureDeletion"; // boolean (since JUnit 4.13)
+  static final String FIELD_FOLDER = "folder"; // java.io.File
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/FieldsOfTestName.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/FieldsOfTestName.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/FieldsOfTestName.java
new file mode 100755
index 0000000..3a2e4bb
--- /dev/null
+++ b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/FieldsOfTestName.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.rules.serializable;
+
+/**
+ * Names of member fields in {@link org.junit.rules.TestName}.
+ */
+public interface FieldsOfTestName {
+  static final String FIELD_NAME = "name"; // String
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/FieldsOfTimeout.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/FieldsOfTimeout.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/FieldsOfTimeout.java
new file mode 100755
index 0000000..fab28ed
--- /dev/null
+++ b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/FieldsOfTimeout.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.rules.serializable;
+
+/**
+ * Names of member fields in {@link org.junit.rules.Timeout}.
+ */
+interface FieldsOfTimeout {
+  static final String FIELD_TIMEOUT = "timeout"; // long
+  static final String FIELD_TIME_UNIT = "timeUnit"; // java.util.concurrent.TimeUnit
+  static final String FIELD_LOOK_FOR_STUCK_THREAD = "lookForStuckThread"; // boolean
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableExternalResource.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableExternalResource.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableExternalResource.java
new file mode 100755
index 0000000..772891f
--- /dev/null
+++ b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableExternalResource.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.rules.serializable;
+
+import org.junit.rules.ExternalResource;
+
+/**
+ * Serializable subclass of {@link org.junit.rules.ExternalResource ExternalResource}.
+ */
+public abstract class SerializableExternalResource extends ExternalResource implements SerializableTestRule {
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableRuleList.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableRuleList.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableRuleList.java
new file mode 100755
index 0000000..b1bbf83
--- /dev/null
+++ b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableRuleList.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.rules.serializable;
+
+import com.gemstone.gemfire.test.junit.rules.RuleList;
+import org.junit.rules.TestRule;
+
+import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Serializable version of {@link RuleList}.
+ */
+public class SerializableRuleList extends RuleList implements SerializableTestRule {
+
+  public SerializableRuleList() {
+    super();
+  }
+
+  public SerializableRuleList(final TestRule rule) {
+    super(rule);
+  }
+
+  public SerializableRuleList(final List<TestRule> rules) {
+    super(rules);
+  }
+
+  @Override
+  public SerializableRuleList add(final TestRule rule) {
+    super.add(rule);
+    return this;
+  }
+
+  @Override
+  protected List<TestRule> rules() {
+    return super.rules();
+  }
+
+  private void readObject(final ObjectInputStream stream) throws InvalidObjectException {
+    throw new InvalidObjectException("SerializationProxy required");
+  }
+
+  private Object writeReplace() {
+    return new SerializationProxy(this);
+  }
+
+  /**
+   * Serialization proxy for {@code SerializableRuleList}.
+   */
+  private static class SerializationProxy implements Serializable {
+
+    private final List<TestRule> rules;
+
+    SerializationProxy(final SerializableRuleList instance) {
+      this.rules = instance.rules();
+    }
+
+    private Object readResolve() {
+      return new SerializableRuleList(this.rules);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTemporaryFolder.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTemporaryFolder.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTemporaryFolder.java
new file mode 100755
index 0000000..6fb01cd
--- /dev/null
+++ b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTemporaryFolder.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.rules.serializable;
+
+import static com.gemstone.gemfire.test.junit.rules.serializable.FieldSerializationUtils.*;
+import static com.gemstone.gemfire.test.junit.rules.serializable.FieldsOfTemporaryFolder.*;
+
+import org.junit.rules.TemporaryFolder;
+
+import java.io.File;
+import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
+import java.io.Serializable;
+
+/**
+ * Serializable subclass of {@link org.junit.rules.TemporaryFolder TemporaryFolder}.
+ * Instance variables of TemporaryFolder are serialized by reflection.
+ */
+public class SerializableTemporaryFolder extends TemporaryFolder implements SerializableTestRule {
+
+  public SerializableTemporaryFolder() {
+    super();
+  }
+
+  public SerializableTemporaryFolder(final File parentFolder) {
+    super(parentFolder);
+  }
+
+  private void readObject(final ObjectInputStream stream) throws InvalidObjectException {
+    throw new InvalidObjectException("SerializationProxy required");
+  }
+
+  private Object writeReplace() {
+    return new SerializationProxy(this);
+  }
+
+  /**
+   * Serialization proxy for {@code SerializableTemporaryFolder}.
+   */
+  private static class SerializationProxy implements Serializable {
+
+    private static final long serialVersionUID = 1905526044015078240L;
+    private final File parentFolder;
+    private final File folder;
+
+    SerializationProxy(final SerializableTemporaryFolder instance) {
+      this.parentFolder = (File) readField(TemporaryFolder.class, instance, FIELD_PARENT_FOLDER);
+      this.folder =(File) readField(TemporaryFolder.class, instance, FIELD_FOLDER);
+    }
+
+    private Object readResolve() {
+      SerializableTemporaryFolder instance = new SerializableTemporaryFolder(this.parentFolder);
+      writeField(TemporaryFolder.class, instance, FIELD_FOLDER, this.folder);
+      return instance;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestFixtureRule.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestFixtureRule.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestFixtureRule.java
new file mode 100755
index 0000000..182b370
--- /dev/null
+++ b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestFixtureRule.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.rules.serializable;
+
+import com.gemstone.gemfire.test.junit.rules.TestFixtureRule;
+
+/**
+ * Serializable version of {@link TestFixtureRule}.
+ */
+public abstract class SerializableTestFixtureRule extends TestFixtureRule implements SerializableTestRule {
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestName.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestName.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestName.java
new file mode 100755
index 0000000..cb87882
--- /dev/null
+++ b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestName.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.rules.serializable;
+
+import static com.gemstone.gemfire.test.junit.rules.serializable.FieldSerializationUtils.*;
+import static com.gemstone.gemfire.test.junit.rules.serializable.FieldsOfTestName.*;
+
+import org.junit.rules.TestName;
+import org.junit.runner.Description;
+
+import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
+import java.io.Serializable;
+
+/**
+ * Serializable subclass of {@link org.junit.rules.TestName TestName}. All
+ * instance variables of {@code TestName} are serialized by reflection.
+ */
+public class SerializableTestName extends TestName implements SerializableTestRule {
+
+  @Override
+  protected void starting(final Description description) {
+    super.starting(description);
+  }
+
+  private void readObject(final ObjectInputStream stream) throws InvalidObjectException {
+    throw new InvalidObjectException("SerializationProxy required");
+  }
+
+  private Object writeReplace() {
+    return new SerializationProxy(this);
+  }
+
+  /**
+   * Serialization proxy for {@code SerializableTestName}.
+   */
+  private static class SerializationProxy implements Serializable {
+
+    private final String name;
+
+    SerializationProxy(final SerializableTestName instance) {
+      this.name = (String) readField(TestName.class, instance, FIELD_NAME);
+    }
+
+    private Object readResolve() {
+      SerializableTestName instance = new SerializableTestName();
+      writeField(TestName.class, instance, FIELD_NAME, this.name);
+      return instance;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestRule.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestRule.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestRule.java
new file mode 100755
index 0000000..f910c14
--- /dev/null
+++ b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestRule.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.rules.serializable;
+
+import java.io.Serializable;
+
+import org.junit.rules.TestRule;
+
+/**
+ * Specifies that a {@link org.junit.rules.TestRule TestRule} is
+ * {@code Serializable}.
+ *
+ * The simplest way to satisfy this interface is to apply {@code transient} to
+ * every instance field.
+ */
+public interface SerializableTestRule extends Serializable, TestRule {
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestWatcher.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestWatcher.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestWatcher.java
new file mode 100755
index 0000000..6292d7c
--- /dev/null
+++ b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestWatcher.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.rules.serializable;
+
+import org.junit.rules.TestWatcher;
+
+/**
+ * Serializable subclass of {@link org.junit.rules.TestWatcher TestWatcher}. No
+ * instance variables are serialized.
+ */
+public abstract class SerializableTestWatcher extends TestWatcher implements SerializableTestRule {
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2487a46/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTimeout.java
----------------------------------------------------------------------
diff --git a/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTimeout.java b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTimeout.java
new file mode 100755
index 0000000..e77120d
--- /dev/null
+++ b/gemfire-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTimeout.java
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.rules.serializable;
+
+import static com.gemstone.gemfire.test.junit.rules.serializable.FieldSerializationUtils.*;
+import static com.gemstone.gemfire.test.junit.rules.serializable.FieldsOfTimeout.*;
+
+import org.junit.rules.Timeout;
+
+import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
+import java.io.Serializable;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Serializable subclass of {@link org.junit.rules.Timeout Timeout}. All
+ * instance variables of {@code Timeout} are serialized by reflection.
+ */
+public class SerializableTimeout extends Timeout implements SerializableTestRule {
+
+  public static Builder builder() {
+    return new Builder();
+  }
+
+  public SerializableTimeout() {
+    this(builder());
+  }
+
+  public SerializableTimeout(final long timeout, final TimeUnit timeUnit) {
+    super(timeout, timeUnit);
+  }
+  
+  protected SerializableTimeout(final Builder builder) {
+    super(builder);
+  }
+
+  private void readObject(final ObjectInputStream stream) throws InvalidObjectException {
+    throw new InvalidObjectException("SerializationProxy required");
+  }
+
+  private Object writeReplace() {
+    return new SerializationProxy(this);
+  }
+
+  /**
+   * Builder for {@code SerializableTimeout}.
+   */
+  public static class Builder extends Timeout.Builder {
+    
+    protected Builder() {
+      super();
+    }
+
+    @Override
+    public Builder withTimeout(final long timeout, final TimeUnit unit) {
+      super.withTimeout(timeout, unit);
+      return this;
+    }
+
+    @Override
+    public Builder withLookingForStuckThread(boolean enable) {
+      super.withLookingForStuckThread(enable);
+      return this;
+    }
+    
+    @Override
+    public SerializableTimeout build() {
+      return new SerializableTimeout(this);
+    }
+  }
+
+  /**
+   * Serialization proxy for {@code SerializableTimeout}.
+   */
+  private static class SerializationProxy implements Serializable {
+
+    private final long timeout;
+    private final TimeUnit timeUnit;
+    private final boolean lookForStuckThread;
+
+    SerializationProxy(SerializableTimeout instance) {
+      this.timeout = (long) readField(Timeout.class, instance, FIELD_TIMEOUT);
+      this.timeUnit =(TimeUnit) readField(Timeout.class, instance, FIELD_TIME_UNIT);
+      this.lookForStuckThread =(boolean) readField(Timeout.class, instance, FIELD_LOOK_FOR_STUCK_THREAD);
+    }
+
+    private Object readResolve() {
+      return new SerializableTimeout.Builder()
+          .withTimeout(this.timeout, this.timeUnit)
+          .withLookingForStuckThread(this.lookForStuckThread)
+          .build();
+    }
+  }
+}