use of com.google.gerrit.entities.SubmitRequirementResult in project gerrit by GerritCodeReview.
the class SubmitRequirementsAdapterTest method customSubmitRule_nullLabels_withStatusOk.
@Test
public void customSubmitRule_nullLabels_withStatusOk() {
SubmitRecord submitRecord = createSubmitRecord("gerrit~IgnoreSelfApprovalRule", Status.OK, /* labels= */
null);
List<SubmitRequirementResult> requirements = SubmitRequirementsAdapter.createResult(submitRecord, labelTypes, psCommitId, /* isForced= */
false);
assertThat(requirements).hasSize(1);
assertResult(requirements.get(0), /* reqName= */
"gerrit~IgnoreSelfApprovalRule", /* submitExpression= */
"rule:gerrit~IgnoreSelfApprovalRule", SubmitRequirementResult.Status.SATISFIED, SubmitRequirementExpressionResult.Status.PASS);
}
use of com.google.gerrit.entities.SubmitRequirementResult in project gerrit by GerritCodeReview.
the class OnStoreSubmitRequirementResultModifierIT method submitRequirementStored_notReturnedWhenHidden.
@Test
public void submitRequirementStored_notReturnedWhenHidden() throws Exception {
TEST_ON_STORE_SUBMIT_REQUIREMENT_RESULT_MODIFIER.setModificationStrategy(ModificationStrategy.OVERRIDE);
TEST_ON_STORE_SUBMIT_REQUIREMENT_RESULT_MODIFIER.hide(true);
PushOneCommit.Result r = createChange();
String changeId = r.getChangeId();
approve(changeId);
ChangeInfo change = gApi.changes().id(changeId).get();
assertThat(change.submitRequirements).hasSize(1);
assertSubmitRequirementStatus(change.submitRequirements, "Code-Review", Status.SATISFIED, /* isLegacy= */
false);
gApi.changes().id(changeId).current().submit();
change = gApi.changes().id(changeId).get();
assertThat(change.submitRequirements).hasSize(0);
ChangeNotes notes = notesFactory.create(project, r.getChange().getId());
SubmitRequirementResult result = notes.getSubmitRequirementsResult().stream().collect(MoreCollectors.onlyElement());
assertThat(result.submitRequirement().name()).isEqualTo("Code-Review");
assertThat(result.status()).isEqualTo(SubmitRequirementResult.Status.OVERRIDDEN);
assertThat(result.submittabilityExpressionResult().get().expression().expressionString()).isEqualTo("label:Code-Review=MAX");
}
Aggregations