diff --git a/config/src/test/scala/com/typesafe/config/impl/PublicApiTest.scala b/config/src/test/scala/com/typesafe/config/impl/PublicApiTest.scala index 67b6d3dc..64a2e2ef 100644 --- a/config/src/test/scala/com/typesafe/config/impl/PublicApiTest.scala +++ b/config/src/test/scala/com/typesafe/config/impl/PublicApiTest.scala @@ -937,6 +937,28 @@ class PublicApiTest extends TestUtils { assertTrue("stuff gets cached repeatedly conf", conf3 eq conf4) } + @Test + def invalidateReferenceConfig(): Unit = { + val orig = ConfigFactory.defaultReference() + val cached = ConfigFactory.defaultReference() + assertTrue("reference config was cached", orig eq cached) + + ConfigFactory.invalidateCaches() + val changed = ConfigFactory.defaultReference() + assertTrue("reference config was invalidated", orig ne changed) + } + + @Test + def invalidateFullConfig(): Unit = { + val orig = ConfigFactory.load() + val cached = ConfigFactory.load() + assertTrue("full config was cached", orig eq cached) + + ConfigFactory.invalidateCaches() + val changed = ConfigFactory.load() + assertTrue("full config was invalidated", orig ne changed) + } + @Test def canUseSomeValuesWithoutResolving(): Unit = { val conf = ConfigFactory.parseString("a=42,b=${NOPE}")