use of com.google.gerrit.acceptance.FakeSubmitRule in project gerrit by GerritCodeReview.
the class AbstractQueryChangesTest method bySubmitRuleResult.
@Test
public void bySubmitRuleResult() throws Exception {
if (getSchemaVersion() < 68) {
assertMissingField(ChangeField.SUBMIT_RULE_RESULT);
return;
}
try (Registration registration = extensionRegistry.newRegistration().add(new FakeSubmitRule())) {
TestRepository<Repo> repo = createProject("repo");
Change change = insert(repo, newChange(repo));
// The fake submit rule exports its ruleName as "FakeSubmitRule"
assertQuery("rule:FakeSubmitRule");
// FakeSubmitRule returns true if change has one or more hashtags.
HashtagsInput hashtag = new HashtagsInput();
hashtag.add = ImmutableSet.of("Tag1");
gApi.changes().id(change.getId().get()).setHashtags(hashtag);
assertQuery("rule:FakeSubmitRule", change);
assertQuery("rule:FakeSubmitRule=OK", change);
assertQuery("rule:FakeSubmitRule=NOT_READY");
}
}
use of com.google.gerrit.acceptance.FakeSubmitRule in project gerrit by GerritCodeReview.
the class AbstractQueryChangesTest method byNonExistingSubmitRule_returnsEmpty.
@Test
public void byNonExistingSubmitRule_returnsEmpty() throws Exception {
// this case.
if (getSchemaVersion() < 68) {
assertMissingField(ChangeField.SUBMIT_RULE_RESULT);
return;
}
try (Registration registration = extensionRegistry.newRegistration().add(new FakeSubmitRule())) {
TestRepository<Repo> repo = createProject("repo");
insert(repo, newChange(repo));
assertQuery("rule:non-existent-rule");
}
}
Aggregations