diff --git a/config/src/test/scala/com/typesafe/config/impl/ConfigSubstitutionTest.scala b/config/src/test/scala/com/typesafe/config/impl/ConfigSubstitutionTest.scala index e0dcdcc5..c67d253f 100644 --- a/config/src/test/scala/com/typesafe/config/impl/ConfigSubstitutionTest.scala +++ b/config/src/test/scala/com/typesafe/config/impl/ConfigSubstitutionTest.scala @@ -924,20 +924,24 @@ class ConfigSubstitutionTest extends TestUtils { @Test def substSelfReferenceIndirect() { + // this has two possible outcomes depending on whether + // we resolve and memoize a first or b first. currently + // java 8's hash table makes it resolve OK, but + // it's also allowed to throw an exception. val obj = parseObject("""a=1, b=${a}, a=${b}""") - val e = intercept[ConfigException.UnresolvedSubstitution] { - resolve(obj) - } - assertTrue("wrong exception: " + e.getMessage, e.getMessage.contains("cycle")) + val resolved = resolve(obj) + assertEquals(1, resolved.getInt("a")) } @Test def substSelfReferenceDoubleIndirect() { + // this has two possible outcomes depending on whether we + // resolve and memoize a, b, or c first. currently java + // 8's hash table makes it resolve OK, but it's also + // allowed to throw an exception. val obj = parseObject("""a=1, b=${c}, c=${a}, a=${b}""") - val e = intercept[ConfigException.UnresolvedSubstitution] { - resolve(obj) - } - assertTrue("wrong exception: " + e.getMessage, e.getMessage.contains("cycle")) + val resolved = resolve(obj) + assertEquals(1, resolved.getInt("a")) } @Test @@ -1002,7 +1006,7 @@ class ConfigSubstitutionTest extends TestUtils { @Test def substOptionalIndirectSelfReferenceInConcat() { - val obj = parseObject("""a=${?b}foo,b=${a}""") + val obj = parseObject("""a=${?b}foo,b=${?a}""") val resolved = resolve(obj) assertEquals("foo", resolved.getString("a")) }