Validate comments and message in PostReview using new interface

This commit adds logic to PostReview to validate all comments that get
published as well as the change message through the new
CommentValidator.

Tests cover both validation success and failure for these cases:

- Publishing draft comments
- Publishing comments directly
- Adding a change message

Surrounding logic is refactored where needed.

Change-Id: I8ed6f721137766fc3d597d7b8484747e151814de
This commit is contained in:
Joerg Zieren
2019-06-06 13:23:02 +02:00
parent 91b4c321cf
commit cf288d44ba
7 changed files with 520 additions and 10 deletions

View File

@@ -25,9 +25,9 @@ import com.google.gerrit.extensions.annotations.ExtensionPoint;
public interface CommentValidator {
/**
* Validate the specified commits.
* Validate the specified comments.
*
* @return An empty list if all commits are valid, or else a list of validation failures.
* @return An empty list if all comments are valid, or else a list of validation failures.
*/
ImmutableList<CommentValidationFailure> validateComments(
ImmutableList<CommentForValidation> comments);