use of com.google.gerrit.entities.SubmitRecord in project gerrit by GerritCodeReview.
the class SubmitRequirementsAdapterTest method customSubmitRule_noLabels_withStatusOk.
@Test
public void customSubmitRule_noLabels_withStatusOk() {
SubmitRecord submitRecord = createSubmitRecord("gerrit~IgnoreSelfApprovalRule", Status.OK, Arrays.asList());
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.SubmitRecord in project gerrit by GerritCodeReview.
the class SubmitRequirementsAdapterTest method customSubmitRule_withMixOfPassingAndFailingLabels.
@Test
public void customSubmitRule_withMixOfPassingAndFailingLabels() {
SubmitRecord submitRecord = createSubmitRecord("gerrit~PrologRule", Status.NOT_READY, Arrays.asList(createLabel("custom-label-1", Label.Status.OK), createLabel("custom-label-2", Label.Status.REJECT)));
List<SubmitRequirementResult> requirements = SubmitRequirementsAdapter.createResult(submitRecord, labelTypes, psCommitId, /* isForced= */
false);
assertThat(requirements).hasSize(2);
assertResult(requirements.get(0), /* reqName= */
"custom-label-1", /* submitExpression= */
"label:custom-label-1=gerrit~PrologRule", SubmitRequirementResult.Status.SATISFIED, SubmitRequirementExpressionResult.Status.PASS);
assertResult(requirements.get(1), /* reqName= */
"custom-label-2", /* submitExpression= */
"label:custom-label-2=gerrit~PrologRule", SubmitRequirementResult.Status.UNSATISFIED, SubmitRequirementExpressionResult.Status.FAIL);
}
use of com.google.gerrit.entities.SubmitRecord in project gerrit by GerritCodeReview.
the class SubmitRequirementsAdapterTest method customSubmitRule_noLabels_withStatusNotReady.
@Test
public void customSubmitRule_noLabels_withStatusNotReady() {
SubmitRecord submitRecord = createSubmitRecord("gerrit~IgnoreSelfApprovalRule", Status.NOT_READY, Arrays.asList());
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.UNSATISFIED, SubmitRequirementExpressionResult.Status.FAIL);
}
use of com.google.gerrit.entities.SubmitRecord in project gerrit by GerritCodeReview.
the class SubmitRequirementsAdapterTest method defaultSubmitRule_withNonExistingLabel.
@Test
public void defaultSubmitRule_withNonExistingLabel() throws Exception {
SubmitRecord submitRecord = createSubmitRecord(DefaultSubmitRule.RULE_NAME, Status.OK, Arrays.asList(createLabel("Non-Existing", Label.Status.OK)));
List<SubmitRequirementResult> requirements = SubmitRequirementsAdapter.createResult(submitRecord, labelTypes, psCommitId, /* isForced= */
false);
assertThat(requirements).isEmpty();
}
use of com.google.gerrit.entities.SubmitRecord in project gerrit by GerritCodeReview.
the class SubmitRequirementsAdapterTest method createSubmitRecord.
private SubmitRecord createSubmitRecord(String ruleName, SubmitRecord.Status status, @Nullable List<Label> labels) {
SubmitRecord record = new SubmitRecord();
record.ruleName = ruleName;
record.status = status;
record.labels = labels;
return record;
}
Aggregations