diff --git a/spring-data-geode-test/src/main/java/org/springframework/data/gemfire/tests/config/TestProperties.java b/spring-data-geode-test/src/main/java/org/springframework/data/gemfire/tests/config/TestProperties.java index 6074ad9..fb02584 100644 --- a/spring-data-geode-test/src/main/java/org/springframework/data/gemfire/tests/config/TestProperties.java +++ b/spring-data-geode-test/src/main/java/org/springframework/data/gemfire/tests/config/TestProperties.java @@ -70,6 +70,15 @@ public class TestProperties implements Iterable { return testPropertiesReference; } + /** + * Destroys the managed {@literal Singleton} {@link TestProperties} instance. + */ + public static void destroy() { + testPropertiesReference.clearSystemProperties(); + testPropertiesReference.clear(); + testPropertiesReference = null; + } + private final Properties testProperties; /** diff --git a/spring-data-geode-test/src/test/java/org/springframework/data/gemfire/tests/config/TestPropertiesIntegrationTests.java b/spring-data-geode-test/src/test/java/org/springframework/data/gemfire/tests/config/TestPropertiesIntegrationTests.java index 1de98d0..c713221 100644 --- a/spring-data-geode-test/src/test/java/org/springframework/data/gemfire/tests/config/TestPropertiesIntegrationTests.java +++ b/spring-data-geode-test/src/test/java/org/springframework/data/gemfire/tests/config/TestPropertiesIntegrationTests.java @@ -69,6 +69,23 @@ public class TestPropertiesIntegrationTests { assertThat(properties).isSameAs(TestProperties.getInstance()); } + @Test + public void destroySingleTestPropertiesInstance() { + + TestProperties testProperties = TestProperties.getInstance() + .set("port", "12345"); + + assertThat(testProperties).isNotNull(); + assertThat(testProperties.get("port")).isEqualTo("12345"); + + TestProperties.destroy(); + + TestProperties newTestProperties = TestProperties.getInstance(); + + assertThat(newTestProperties).isNotSameAs(testProperties); + assertThat(newTestProperties).isEmpty(); + } + @Test public void getTestPropertiesResourceIsCorrect() {