use of com.google.gerrit.entities.PatchSetApproval in project gerrit by GerritCodeReview.
the class LabelNormalizerTest method noNormalizeByPermission.
@Test
public void noNormalizeByPermission() throws Exception {
projectOperations.allProjectsForUpdate().add(allowLabel(LabelId.CODE_REVIEW).ref("refs/heads/*").group(REGISTERED_USERS).range(-1, 1)).add(allowLabel(LabelId.VERIFIED).ref("refs/heads/*").group(REGISTERED_USERS).range(-1, 1)).update();
PatchSetApproval cr = psa(userId, LabelId.CODE_REVIEW, 2);
PatchSetApproval v = psa(userId, LabelId.VERIFIED, 1);
assertEquals(Result.create(list(cr, v), list(), list()), norm.normalize(notes, list(cr, v)));
}
use of com.google.gerrit.entities.PatchSetApproval in project gerrit by GerritCodeReview.
the class LabelNormalizerTest method emptyPermissionRangeKeepsResult.
@Test
public void emptyPermissionRangeKeepsResult() throws Exception {
PatchSetApproval cr = psa(userId, LabelId.CODE_REVIEW, 1);
PatchSetApproval v = psa(userId, LabelId.VERIFIED, 1);
assertEquals(Result.create(list(cr, v), list(), list()), norm.normalize(notes, list(cr, v)));
}
use of com.google.gerrit.entities.PatchSetApproval in project gerrit by GerritCodeReview.
the class LabelNormalizerTest method normalizeByType.
@Test
public void normalizeByType() throws Exception {
projectOperations.allProjectsForUpdate().add(allowLabel(LabelId.CODE_REVIEW).ref("refs/heads/*").group(REGISTERED_USERS).range(-5, 5)).add(allowLabel(LabelId.VERIFIED).ref("refs/heads/*").group(REGISTERED_USERS).range(-5, 5)).update();
PatchSetApproval cr = psa(userId, LabelId.CODE_REVIEW, 5);
PatchSetApproval v = psa(userId, LabelId.VERIFIED, 5);
assertEquals(Result.create(list(), list(copy(cr, 2), copy(v, 1)), list()), norm.normalize(notes, list(cr, v)));
}
use of com.google.gerrit.entities.PatchSetApproval in project gerrit by GerritCodeReview.
the class LabelNormalizerTest method explicitZeroVoteOnNonEmptyRangeIsPresent.
@Test
public void explicitZeroVoteOnNonEmptyRangeIsPresent() throws Exception {
projectOperations.allProjectsForUpdate().add(allowLabel(LabelId.CODE_REVIEW).ref("refs/heads/*").group(REGISTERED_USERS).range(-1, 1)).update();
PatchSetApproval cr = psa(userId, LabelId.CODE_REVIEW, 0);
PatchSetApproval v = psa(userId, LabelId.VERIFIED, 0);
assertEquals(Result.create(list(cr, v), list(), list()), norm.normalize(notes, list(cr, v)));
}
use of com.google.gerrit.entities.PatchSetApproval in project gerrit by GerritCodeReview.
the class PatchSetApprovalProtoConverterTest method mandatoryValuesConvertedToProtoAndBackAgain.
@Test
public void mandatoryValuesConvertedToProtoAndBackAgain() {
PatchSetApproval patchSetApproval = PatchSetApproval.builder().key(PatchSetApproval.key(PatchSet.id(Change.id(42), 14), Account.id(100013), LabelId.create("label-8"))).value(456).granted(Instant.ofEpochMilli(987654L)).build();
PatchSetApproval convertedPatchSetApproval = protoConverter.fromProto(protoConverter.toProto(patchSetApproval));
assertThat(convertedPatchSetApproval).isEqualTo(patchSetApproval);
}
Aggregations