CheckInput: Mark all fields as Nullable
All fields are nullable when updating a check. Be consistent and add the
@Nullable annotation to all fields.
Also test that an update with an empty input doesn't fail.
Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: I990e2a2a315ffff1e951d0eaee67b2a01773e679
diff --git a/java/com/google/gerrit/plugins/checks/api/CheckInput.java b/java/com/google/gerrit/plugins/checks/api/CheckInput.java
index 5d1d970..b337a79 100644
--- a/java/com/google/gerrit/plugins/checks/api/CheckInput.java
+++ b/java/com/google/gerrit/plugins/checks/api/CheckInput.java
@@ -22,9 +22,9 @@
/** Input to create or update a {@link com.google.gerrit.plugins.checks.Check}. */
public class CheckInput {
/** UUID of the checker. */
- public String checkerUuid;
+ @Nullable public String checkerUuid;
/** State of the check. */
- public CheckState state;
+ @Nullable public CheckState state;
/** Fully qualified URL to detailed result on the Checker's service. */
@Nullable public String url;
/** Date/Time at which the checker started processing this check. */
diff --git a/javatests/com/google/gerrit/plugins/checks/acceptance/api/UpdateCheckIT.java b/javatests/com/google/gerrit/plugins/checks/acceptance/api/UpdateCheckIT.java
index c356056..f41517e 100644
--- a/javatests/com/google/gerrit/plugins/checks/acceptance/api/UpdateCheckIT.java
+++ b/javatests/com/google/gerrit/plugins/checks/acceptance/api/UpdateCheckIT.java
@@ -117,6 +117,16 @@
}
@Test
+ public void updateWithEmptyInput() throws Exception {
+ assertThat(
+ checksApiFactory
+ .revision(patchSetId)
+ .id(checkKey.checkerUuid())
+ .update(new CheckInput()))
+ .isNotNull();
+ }
+
+ @Test
public void updateResultsInNewUpdatedTimestamp() throws Exception {
CheckInput input = new CheckInput();
input.state = CheckState.FAILED;