AbstractCodeOwnersTest: Add method to enable the code owners functionality

This is similar to the disableCodeOwnersForProject in
AbstractCodeOwnersTest that already exists.

Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: I7b194b797cfb681f68075b227c669991c80751b8
diff --git a/java/com/google/gerrit/plugins/codeowners/acceptance/AbstractCodeOwnersTest.java b/java/com/google/gerrit/plugins/codeowners/acceptance/AbstractCodeOwnersTest.java
index a3dfde6..e8873e4 100644
--- a/java/com/google/gerrit/plugins/codeowners/acceptance/AbstractCodeOwnersTest.java
+++ b/java/com/google/gerrit/plugins/codeowners/acceptance/AbstractCodeOwnersTest.java
@@ -137,6 +137,10 @@
     setCodeOwnersConfig(project, null, StatusConfig.KEY_DISABLED, "true");
   }
 
+  protected void enableCodeOwnersForProject(Project.NameKey project) throws Exception {
+    setCodeOwnersConfig(project, null, StatusConfig.KEY_DISABLED, "false");
+  }
+
   protected void setCodeOwnersConfig(
       Project.NameKey project, String subsection, String key, String value) throws Exception {
     Config codeOwnersConfig = new Config();
diff --git a/javatests/com/google/gerrit/plugins/codeowners/acceptance/api/CodeOwnerConfigValidatorIT.java b/javatests/com/google/gerrit/plugins/codeowners/acceptance/api/CodeOwnerConfigValidatorIT.java
index 6f3374b..5595f93 100644
--- a/javatests/com/google/gerrit/plugins/codeowners/acceptance/api/CodeOwnerConfigValidatorIT.java
+++ b/javatests/com/google/gerrit/plugins/codeowners/acceptance/api/CodeOwnerConfigValidatorIT.java
@@ -50,7 +50,6 @@
 import com.google.gerrit.plugins.codeowners.backend.proto.ProtoBackend;
 import com.google.gerrit.plugins.codeowners.backend.proto.ProtoCodeOwnerConfigParser;
 import com.google.gerrit.plugins.codeowners.config.BackendConfig;
-import com.google.gerrit.plugins.codeowners.config.StatusConfig;
 import com.google.inject.Inject;
 import org.eclipse.jgit.lib.AnyObjectId;
 import org.eclipse.jgit.lib.ObjectId;
@@ -343,7 +342,7 @@
     r.assertOkStatus();
 
     // re-enable the code owners functionality for the project
-    setCodeOwnersConfig(project, null, StatusConfig.KEY_DISABLED, "false");
+    enableCodeOwnersForProject(project);
 
     // delete the invalid code owner config file
     PushOneCommit push =
@@ -369,7 +368,7 @@
     r.assertOkStatus();
 
     // re-enable the code owners functionality for the project
-    setCodeOwnersConfig(project, null, StatusConfig.KEY_DISABLED, "false");
+    enableCodeOwnersForProject(project);
 
     // update the code owner config so that it is still not parseable
     r =
@@ -408,7 +407,7 @@
     r.assertOkStatus();
 
     // re-enable the code owners functionality for the project
-    setCodeOwnersConfig(project, null, StatusConfig.KEY_DISABLED, "false");
+    enableCodeOwnersForProject(project);
 
     // update the code owner config so that it is parseable now, but has validation issues
     String unknownEmail1 = "non-existing-email@example.com";
@@ -459,7 +458,7 @@
     r.assertOkStatus();
 
     // re-enable the code owners functionality for the project
-    setCodeOwnersConfig(project, null, StatusConfig.KEY_DISABLED, "false");
+    enableCodeOwnersForProject(project);
 
     // update the code owner config so that the validation issue still exists, but no new issue is
     // introduced
@@ -621,7 +620,7 @@
     r.assertOkStatus();
 
     // re-enable the code owners functionality for the project
-    setCodeOwnersConfig(project, null, StatusConfig.KEY_DISABLED, "false");
+    enableCodeOwnersForProject(project);
 
     // update the code owner config so that the validation issue still exists and a new issue is
     // introduced
@@ -682,7 +681,7 @@
     r.assertOkStatus();
 
     // re-enable the code owners functionality for the project
-    setCodeOwnersConfig(project, null, StatusConfig.KEY_DISABLED, "false");
+    enableCodeOwnersForProject(project);
 
     // approve the change
     approve(r.getChangeId());
@@ -733,7 +732,7 @@
     r.assertOkStatus();
 
     // re-enable the code owners functionality for the project
-    setCodeOwnersConfig(project, null, StatusConfig.KEY_DISABLED, "false");
+    enableCodeOwnersForProject(project);
 
     // approve the change
     approve(r.getChangeId());
@@ -1181,7 +1180,7 @@
     gApi.changes().id(r.getChangeId()).current().submit();
 
     // re-enable the code owners functionality for the project
-    setCodeOwnersConfig(project, null, StatusConfig.KEY_DISABLED, "false");
+    enableCodeOwnersForProject(project);
 
     // create a code owner config that imports a non-parseable code owner config
     CodeOwnerConfig.Key keyOfImportingCodeOwnerConfig = createCodeOwnerConfigKey("/");
diff --git a/javatests/com/google/gerrit/plugins/codeowners/backend/CodeOwnerConfigScannerTest.java b/javatests/com/google/gerrit/plugins/codeowners/backend/CodeOwnerConfigScannerTest.java
index 14bf652..06be307 100644
--- a/javatests/com/google/gerrit/plugins/codeowners/backend/CodeOwnerConfigScannerTest.java
+++ b/javatests/com/google/gerrit/plugins/codeowners/backend/CodeOwnerConfigScannerTest.java
@@ -27,7 +27,6 @@
 import com.google.gerrit.plugins.codeowners.JgitPath;
 import com.google.gerrit.plugins.codeowners.acceptance.AbstractCodeOwnersTest;
 import com.google.gerrit.plugins.codeowners.acceptance.testsuite.CodeOwnerConfigOperations;
-import com.google.gerrit.plugins.codeowners.config.StatusConfig;
 import java.nio.file.Paths;
 import org.eclipse.jgit.errors.ConfigInvalidException;
 import org.eclipse.jgit.junit.TestRepository;
@@ -438,6 +437,6 @@
             .getChangeId();
     approve(changeId);
     gApi.changes().id(changeId).current().submit();
-    setCodeOwnersConfig(project, null, StatusConfig.KEY_DISABLED, "false");
+    enableCodeOwnersForProject(project);
   }
 }
diff --git a/javatests/com/google/gerrit/plugins/codeowners/config/CodeOwnersPluginConfigurationTest.java b/javatests/com/google/gerrit/plugins/codeowners/config/CodeOwnersPluginConfigurationTest.java
index 4ff9123..63ff5d7 100644
--- a/javatests/com/google/gerrit/plugins/codeowners/config/CodeOwnersPluginConfigurationTest.java
+++ b/javatests/com/google/gerrit/plugins/codeowners/config/CodeOwnersPluginConfigurationTest.java
@@ -816,10 +816,6 @@
     setCodeOwnersConfig(project, null, StatusConfig.KEY_DISABLED_BRANCH, disabledBranch);
   }
 
-  private void enableCodeOwnersForProject(Project.NameKey project) throws Exception {
-    setCodeOwnersConfig(project, null, StatusConfig.KEY_DISABLED, "false");
-  }
-
   private void enableCodeOwnersForAllBranches(Project.NameKey project) throws Exception {
     setCodeOwnersConfig(project, null, StatusConfig.KEY_DISABLED_BRANCH, "");
   }