QueryParserTest: Migrate from try-catch-fail to assertFails
Change-Id: I5080fca92aed1153ab4fe591220093833d80412d
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user