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 21:29:00 UTC

incubator-geode git commit: Remove TestFixtureRule

Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-953 2c63e209d -> dd8678187


Remove TestFixtureRule


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

Branch: refs/heads/feature/GEODE-953
Commit: dd8678187094076ac0f7e61a193f59e539bc8597
Parents: 2c63e20
Author: Kirk Lund <kl...@pivotal.io>
Authored: Tue Feb 23 12:28:45 2016 -0800
Committer: Kirk Lund <kl...@pivotal.io>
Committed: Tue Feb 23 12:28:45 2016 -0800

----------------------------------------------------------------------
 .../dunit/rules/DistributedTestFixtureRule.java |  57 ---
 .../test/junit/rules/TestFixtureRule.java       | 143 -------
 .../SerializableTestFixtureRule.java            |  25 --
 .../test/junit/rules/TestFixtureRuleTest.java   | 384 -------------------
 .../SerializableTestFixtureRuleTest.java        |  70 ----
 5 files changed, 679 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/dd867818/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/DistributedTestFixtureRule.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/DistributedTestFixtureRule.java b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/DistributedTestFixtureRule.java
deleted file mode 100755
index 86e93f3..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/DistributedTestFixtureRule.java
+++ /dev/null
@@ -1,57 +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.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/dd867818/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/TestFixtureRule.java
----------------------------------------------------------------------
diff --git a/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/TestFixtureRule.java b/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/TestFixtureRule.java
deleted file mode 100755
index 7468c1f..0000000
--- a/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/TestFixtureRule.java
+++ /dev/null
@@ -1,143 +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.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/dd867818/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestFixtureRule.java
----------------------------------------------------------------------
diff --git a/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestFixtureRule.java b/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestFixtureRule.java
deleted file mode 100755
index 182b370..0000000
--- a/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestFixtureRule.java
+++ /dev/null
@@ -1,25 +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.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/dd867818/geode-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/TestFixtureRuleTest.java
----------------------------------------------------------------------
diff --git a/geode-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/TestFixtureRuleTest.java b/geode-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/TestFixtureRuleTest.java
deleted file mode 100755
index a3ab5ed..0000000
--- a/geode-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/TestFixtureRuleTest.java
+++ /dev/null
@@ -1,384 +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.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/dd867818/geode-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestFixtureRuleTest.java
----------------------------------------------------------------------
diff --git a/geode-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestFixtureRuleTest.java b/geode-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestFixtureRuleTest.java
deleted file mode 100755
index cf09e05..0000000
--- a/geode-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/serializable/SerializableTestFixtureRuleTest.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.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 = -1;
-
-    public FakeSerializableTestFixtureRule value(final int value) {
-      this.value = value;
-      return this;
-    }
-
-    public int value() {
-      return this.value;
-    }
-  }
-}