QueryParserTest: Migrate from try-catch-fail to assertFails

Change-Id: I5080fca92aed1153ab4fe591220093833d80412d
This commit is contained in:
David Pursehouse
2019-05-22 20:41:11 +09:00
parent 8dde9c4c98
commit 6c965d441f

View File

@@ -14,7 +14,6 @@
package com.google.gerrit.index.query;
import static com.google.common.truth.Truth.assert_;
import static com.google.gerrit.index.query.QueryParser.AND;
import static com.google.gerrit.index.query.QueryParser.COLON;
import static com.google.gerrit.index.query.QueryParser.DEFAULT_FIELD;
@@ -22,6 +21,7 @@ import static com.google.gerrit.index.query.QueryParser.FIELD_NAME;
import static com.google.gerrit.index.query.QueryParser.SINGLE_WORD;
import static com.google.gerrit.index.query.QueryParser.parse;
import static com.google.gerrit.index.query.testing.TreeSubject.assertThat;
import static com.google.gerrit.testing.GerritJUnit.assertThrows;
import org.antlr.runtime.tree.Tree;
import org.junit.Test;
@@ -205,11 +205,6 @@ public class QueryParserTest {
}
private static void assertParseFails(String query) {
try {
parse(query);
assert_().fail("expected parse to fail: %s", query);
} catch (QueryParseException e) {
// Expected.
}
assertThrows(QueryParseException.class, () -> parse(query));
}
}