diff options
author | Jon Bratseth <bratseth@verizonmedia.com> | 2019-10-07 14:04:01 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@verizonmedia.com> | 2019-10-07 14:04:01 +0200 |
commit | 46ea96a07e4b2a08475222f9a4d08a40a582253d (patch) | |
tree | 356c16c6052728a2c426a0c4375f8f1b31141ac3 /container-search/src/test/java/com/yahoo/search/query | |
parent | 9f67d07036d056673b7b907371005b126b957589 (diff) |
Validate local substitutions during compile
Diffstat (limited to 'container-search/src/test/java/com/yahoo/search/query')
-rw-r--r-- | container-search/src/test/java/com/yahoo/search/query/profile/test/QueryProfileSubstitutionTestCase.java | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/container-search/src/test/java/com/yahoo/search/query/profile/test/QueryProfileSubstitutionTestCase.java b/container-search/src/test/java/com/yahoo/search/query/profile/test/QueryProfileSubstitutionTestCase.java index 1e51a4890be..b3b83b9c07e 100644 --- a/container-search/src/test/java/com/yahoo/search/query/profile/test/QueryProfileSubstitutionTestCase.java +++ b/container-search/src/test/java/com/yahoo/search/query/profile/test/QueryProfileSubstitutionTestCase.java @@ -43,11 +43,20 @@ public class QueryProfileSubstitutionTestCase { p.set("message","Hello %{.world}!", null); p.set("world", "world", null); assertEquals("Hello world!", p.compile(null).get("message")); + } - QueryProfile p2 = new QueryProfile("test2"); - p2.addInherited(p); - p2.set("world", "universe", null); - assertEquals("Hello universe!", p2.compile(null).get("message")); + @Test + public void testRelativeSubstitutionNotFound() { + try { + QueryProfile p = new QueryProfile("test"); + p.set("message", "Hello %{.world}!", null); + assertEquals("Hello world!", p.compile(null).get("message")); + fail("Expected exception"); + } + catch (IllegalArgumentException e) { + assertEquals("Invalid query profile 'test': Could not resolve local substitution 'world' in variant DimensionBinding []", + Exceptions.toMessageString(e)); + } } @Test |