summaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorgjoranv <gv@oath.com>2018-12-06 13:13:57 +0100
committergjoranv <gv@oath.com>2018-12-06 14:19:01 +0100
commit9820f82abab66b045f6ce65c03477903180f61b4 (patch)
treeefb0ce12a49e8eca52058196193b36ddf6d7373c /config-model
parent49de3f5478c4a44c8f5cebcb15062eb6289ddd35 (diff)
Update to latest ph-javacc-maven-plugin.
- Update FastCharStream method names to follow changes in generated CharStream class. - Update expected test output due to improvements in generated code. - Improve ability to debug tests by more clearly printing out the diff between expected and actual output.
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/RankingConstantTest.java33
1 files changed, 19 insertions, 14 deletions
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/RankingConstantTest.java b/config-model/src/test/java/com/yahoo/searchdefinition/RankingConstantTest.java
index fd69e282fcb..4297b8697b4 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/RankingConstantTest.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/RankingConstantTest.java
@@ -11,6 +11,7 @@ import java.util.Iterator;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static com.yahoo.config.model.test.TestUtil.joinLines;
+import static org.junit.Assert.fail;
/**
* @author gjoranv
@@ -186,22 +187,26 @@ public class RankingConstantTest {
}
@Test
- public void constant_uri_only_supports_http_and_https() throws Exception {
+ public void constant_uri_only_supports_http_and_https() {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
SearchBuilder searchBuilder = new SearchBuilder(rankProfileRegistry);
- thrown.expect(ParseException.class);
- thrown.expectMessage("Encountered \" <IDENTIFIER> \"ftp \"\" at line 5, column 10.\n" +
- "Was expecting:\n" +
- " <URI_PATH> ...");
- searchBuilder.importString(joinLines(
- "search test {",
- " document test { }",
- " constant foo {",
- " type: tensor(x{})",
- " uri: ftp:somewhere.far.away/in/another-galaxy",
- " }",
- "}"
- ));
+ String expectedMessage = "Encountered \" <IDENTIFIER> \"ftp\"\" at line 5, column 10.\n\n" +
+ "Was expecting:\n\n" +
+ "<URI_PATH> ...";
+ try {
+ searchBuilder.importString(joinLines(
+ "search test {",
+ " document test { }",
+ " constant foo {",
+ " type: tensor(x{})",
+ " uri: ftp:somewhere.far.away/in/another-galaxy",
+ " }",
+ "}"
+ ));
+ } catch (ParseException e) {
+ if (! e.getMessage().startsWith(expectedMessage))
+ fail("Expected exception with message starting with:\n'" + expectedMessage + "\nBut got:\n'" + e.getMessage());
+ }
}
}