GetCheckIT: Don't set check fields which are unrelated to the test
Several tests were unnecessarily setting a check state when creating
checks. If the check state is not relevant for the test it improves
readability to not set it at all.
Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: I672ef000e6391f06cebafc073e8f4232d7b3e9c9
diff --git a/javatests/com/google/gerrit/plugins/checks/acceptance/api/GetCheckIT.java b/javatests/com/google/gerrit/plugins/checks/acceptance/api/GetCheckIT.java
index 14ae012..8629d37 100644
--- a/javatests/com/google/gerrit/plugins/checks/acceptance/api/GetCheckIT.java
+++ b/javatests/com/google/gerrit/plugins/checks/acceptance/api/GetCheckIT.java
@@ -200,7 +200,7 @@
CheckerUuid checkerUuid = checkerOperations.newChecker().repository(otherProject).create();
CheckKey checkKey = CheckKey.create(project, patchSetId, checkerUuid);
- checkOperations.newCheck(checkKey).setState(CheckState.RUNNING).upsert();
+ checkOperations.newCheck(checkKey).upsert();
assertThat(getCheckInfo(patchSetId, checkerUuid))
.isEqualTo(checkOperations.check(checkKey).asInfo());
@@ -212,7 +212,7 @@
checkerOperations.newChecker().repository(project).query("message:not-matching").create();
CheckKey checkKey = CheckKey.create(project, patchSetId, checkerUuid);
- checkOperations.newCheck(checkKey).setState(CheckState.RUNNING).upsert();
+ checkOperations.newCheck(checkKey).upsert();
assertThat(getCheckInfo(patchSetId, checkerUuid))
.isEqualTo(checkOperations.check(checkKey).asInfo());
@@ -228,7 +228,7 @@
.create();
CheckKey checkKey = CheckKey.create(project, patchSetId, checkerUuid);
- checkOperations.newCheck(checkKey).setState(CheckState.RUNNING).upsert();
+ checkOperations.newCheck(checkKey).upsert();
CheckInfo checkInfo = checksApiFactory.revision(patchSetId).id(checkerUuid).get();
assertThat(checkInfo).isEqualTo(checkOperations.check(checkKey).asInfo());
@@ -244,7 +244,7 @@
.create();
CheckKey checkKey = CheckKey.create(project, patchSetId, checkerUuid);
- checkOperations.newCheck(checkKey).setState(CheckState.RUNNING).upsert();
+ checkOperations.newCheck(checkKey).upsert();
CheckInfo checkInfo = checksApiFactory.revision(patchSetId).id(checkerUuid).get();
assertThat(checkInfo).isEqualTo(checkOperations.check(checkKey).asInfo());
@@ -255,7 +255,7 @@
CheckerUuid checkerUuid = checkerOperations.newChecker().repository(project).create();
CheckKey checkKey = CheckKey.create(project, patchSetId, checkerUuid);
- checkOperations.newCheck(checkKey).setState(CheckState.RUNNING).upsert();
+ checkOperations.newCheck(checkKey).upsert();
checkerOperations.checker(checkerUuid).forUpdate().disable().update();
@@ -267,7 +267,7 @@
public void getCheckForInvalidChecker() throws Exception {
CheckerUuid checkerUuid = checkerOperations.newChecker().repository(project).create();
CheckKey checkKey = CheckKey.create(project, patchSetId, checkerUuid);
- checkOperations.newCheck(checkKey).setState(CheckState.RUNNING).upsert();
+ checkOperations.newCheck(checkKey).upsert();
checkerOperations.checker(checkerUuid).forUpdate().forceInvalidConfig().update();
@@ -279,7 +279,7 @@
public void getCheckForNonExistingChecker() throws Exception {
CheckerUuid checkerUuid = checkerOperations.newChecker().repository(project).create();
CheckKey checkKey = CheckKey.create(project, patchSetId, checkerUuid);
- checkOperations.newCheck(checkKey).setState(CheckState.RUNNING).upsert();
+ checkOperations.newCheck(checkKey).upsert();
checkerOperations.checker(checkerUuid).forUpdate().deleteRef().update();
assertThat(getCheckInfo(patchSetId, checkerUuid))
@@ -346,7 +346,7 @@
CheckerUuid checkerUuid = checkerOperations.newChecker().repository(project).create();
CheckKey checkKey = CheckKey.create(project, patchSetId, checkerUuid);
- checkOperations.newCheck(checkKey).setState(CheckState.RUNNING).upsert();
+ checkOperations.newCheck(checkKey).upsert();
assertThat(getCheckInfo(patchSetId, checkerUuid))
.isEqualTo(checkOperations.check(checkKey).asInfo());
@@ -356,7 +356,7 @@
public void checkForDeletedChangeDoesNotExist() throws Exception {
CheckerUuid checkerUuid = checkerOperations.newChecker().repository(project).create();
CheckKey checkKey = CheckKey.create(project, patchSetId, checkerUuid);
- checkOperations.newCheck(checkKey).setState(CheckState.RUNNING).upsert();
+ checkOperations.newCheck(checkKey).upsert();
gApi.changes().id(patchSetId.getParentKey().get()).delete();