Merge changes If7924ced,If8b74f4b
* changes:
CodeOwnerProjectConfigInfo: Update javadoc to say when fields are not set
GetCodeOwnerProjectConfigIT: Fix tests
diff --git a/java/com/google/gerrit/plugins/codeowners/api/CodeOwnerProjectConfigInfo.java b/java/com/google/gerrit/plugins/codeowners/api/CodeOwnerProjectConfigInfo.java
index 2bf9a46..f559739 100644
--- a/java/com/google/gerrit/plugins/codeowners/api/CodeOwnerProjectConfigInfo.java
+++ b/java/com/google/gerrit/plugins/codeowners/api/CodeOwnerProjectConfigInfo.java
@@ -20,7 +20,11 @@
* <p>This class determines the JSON format of code owner project configuration in the REST API.
*/
public class CodeOwnerProjectConfigInfo {
- /** The general code owners configuration. */
+ /**
+ * The general code owners configuration.
+ *
+ * <p>Not set if {@code status.disabled} is {@code true}.
+ */
public GeneralInfo general;
/**
@@ -31,16 +35,26 @@
*/
public CodeOwnersStatusInfo status;
- /** The code owner backend configuration. */
+ /**
+ * The code owner backend configuration.
+ *
+ * <p>Not set if {@code status.disabled} is {@code true}.
+ */
public BackendInfo backend;
/**
* The approval that is required from code owners to approve the files in a change.
*
* <p>Defines which approval counts as code owner approval.
+ *
+ * <p>Not set if {@code status.disabled} is {@code true}.
*/
public RequiredApprovalInfo requiredApproval;
- /** The approval that is required to override the code owners submit check. */
+ /**
+ * The approval that is required to override the code owners submit check.
+ *
+ * <p>Not set if {@code status.disabled} is {@code true}.
+ */
public RequiredApprovalInfo overrideApproval;
}
diff --git a/javatests/com/google/gerrit/plugins/codeowners/acceptance/api/GetCodeOwnerProjectConfigIT.java b/javatests/com/google/gerrit/plugins/codeowners/acceptance/api/GetCodeOwnerProjectConfigIT.java
index b820d98..e936dda 100644
--- a/javatests/com/google/gerrit/plugins/codeowners/acceptance/api/GetCodeOwnerProjectConfigIT.java
+++ b/javatests/com/google/gerrit/plugins/codeowners/acceptance/api/GetCodeOwnerProjectConfigIT.java
@@ -233,14 +233,6 @@
@Test
public void getConfigWithConfiguredOverrideApproval() throws Exception {
- configureImplicitApprovals(project);
- CodeOwnerProjectConfigInfo codeOwnerProjectConfigInfo =
- projectCodeOwnersApiFactory.project(project).getConfig();
- assertThat(codeOwnerProjectConfigInfo.general.implicitApprovals).isTrue();
- }
-
- @Test
- public void getConfigWithEnabledImplicitApprovals() throws Exception {
configureOverrideApproval(project, "Code-Review+2");
CodeOwnerProjectConfigInfo codeOwnerProjectConfigInfo =
projectCodeOwnersApiFactory.project(project).getConfig();
@@ -248,6 +240,14 @@
assertThat(codeOwnerProjectConfigInfo.overrideApproval.value).isEqualTo(2);
}
+ @Test
+ public void getConfigWithEnabledImplicitApprovals() throws Exception {
+ configureImplicitApprovals(project);
+ CodeOwnerProjectConfigInfo codeOwnerProjectConfigInfo =
+ projectCodeOwnersApiFactory.project(project).getConfig();
+ assertThat(codeOwnerProjectConfigInfo.general.implicitApprovals).isTrue();
+ }
+
private void configureFileExtension(Project.NameKey project, String fileExtension)
throws Exception {
setConfig(project, null, GeneralConfig.KEY_FILE_EXTENSION, fileExtension);