Remove the PowerMockito dependencies on Gerrit v3.0

Gerrit v3.0 uses Mockito 2.x in its test automation framework,
which is largely incompatible with PowerMockito.

PowerMockito is used only for mocking static methods that were
not even used in the tests and thus is a redundant dependency
that can be completely removed.

Change-Id: I7595a8359b17453fd62d3f2aff975eec1be705f8
diff --git a/BUILD b/BUILD
index ba18e42..62ffd1c 100644
--- a/BUILD
+++ b/BUILD
@@ -37,8 +37,5 @@
     visibility = ["//visibility:public"],
     exports = PLUGIN_DEPS + PLUGIN_TEST_DEPS + [
         ":slack-integration__plugin",
-        "@mockito//jar",
-        "@powermock_module_junit4//jar",
-        "@powermock_api_mockito//jar",
     ],
 )
diff --git a/WORKSPACE b/WORKSPACE
index ea404d9..96d22b4 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -24,7 +24,3 @@
 
 # Load release Plugin API
 gerrit_api()
-
-load("//:external_plugin_deps.bzl", "external_plugin_deps")
-
-external_plugin_deps()
diff --git a/external_plugin_deps.bzl b/external_plugin_deps.bzl
deleted file mode 100644
index 5e4c4c7..0000000
--- a/external_plugin_deps.bzl
+++ /dev/null
@@ -1,22 +0,0 @@
-load("//tools/bzl:maven_jar.bzl", "maven_jar")
-
-def external_plugin_deps():
-    POWER_MOCK_VERSION = "1.6.2"
-
-    maven_jar(
-        name = "powermock_module_junit4",
-        artifact = "org.powermock:powermock-module-junit4:" + POWER_MOCK_VERSION,
-        sha1 = "dff58978da716e000463bc1b08013d6a7cf3d696",
-    )
-
-    maven_jar(
-        name = "powermock_api_mockito",
-        artifact = "org.powermock:powermock-api-mockito:" + POWER_MOCK_VERSION,
-        sha1 = "c213230ae20a7b422f3d622a261d0e3427d2464c",
-    )
-
-    maven_jar(
-        name = "mockito",
-        artifact = "org.mockito:mockito-all:1.10.19",
-        sha1 = "539df70269cc254a58cccc5d8e43286b4a73bf30",
-    )
diff --git a/src/test/java/com/cisco/gerrit/plugins/slack/client/WebhookClientIntegrationTest.java b/src/test/java/com/cisco/gerrit/plugins/slack/client/WebhookClientIntegrationTest.java
index b5e8011..f8c01e4 100644
--- a/src/test/java/com/cisco/gerrit/plugins/slack/client/WebhookClientIntegrationTest.java
+++ b/src/test/java/com/cisco/gerrit/plugins/slack/client/WebhookClientIntegrationTest.java
@@ -29,28 +29,14 @@
 import com.google.gerrit.server.config.PluginConfigFactory;
 import java.io.InputStream;
 import java.util.Properties;
-import org.junit.Before;
 import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
 
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({Project.NameKey.class})
 public class WebhookClientIntegrationTest {
   private static final String PROJECT_NAME = "test-project";
 
-  private Project.NameKey mockNameKey = mock(Project.NameKey.class);
   private PluginConfigFactory mockConfigFactory = mock(PluginConfigFactory.class);
   private PluginConfig mockPluginConfig = mock(PluginConfig.class);
 
-  @Before
-  public void setup() throws Exception {
-    PowerMockito.mockStatic(Project.NameKey.class);
-    when(Project.NameKey.parse(PROJECT_NAME)).thenReturn(mockNameKey);
-  }
-
   private ProjectConfig getConfig() throws Exception {
     Project.NameKey projectNameKey;
     projectNameKey = Project.NameKey.parse(PROJECT_NAME);
diff --git a/src/test/java/com/cisco/gerrit/plugins/slack/config/ProjectConfigTest.java b/src/test/java/com/cisco/gerrit/plugins/slack/config/ProjectConfigTest.java
index efd5c6f..0555dd3 100644
--- a/src/test/java/com/cisco/gerrit/plugins/slack/config/ProjectConfigTest.java
+++ b/src/test/java/com/cisco/gerrit/plugins/slack/config/ProjectConfigTest.java
@@ -29,19 +29,11 @@
 import com.google.gerrit.server.config.PluginConfigFactory;
 import org.junit.Before;
 import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
 
 /** Tests for the PluginConfig class. */
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({Project.NameKey.class})
 public class ProjectConfigTest {
   private static final String PROJECT_NAME = "test-project";
 
-  private Project.NameKey mockNameKey = mock(Project.NameKey.class);
-
   private PluginConfigFactory mockConfigFactory = mock(PluginConfigFactory.class);
 
   private PluginConfig mockPluginConfig = mock(PluginConfig.class);
@@ -50,9 +42,6 @@
 
   @Before
   public void setup() throws Exception {
-    PowerMockito.mockStatic(Project.NameKey.class);
-    when(Project.NameKey.parse(PROJECT_NAME)).thenReturn(mockNameKey);
-
     Project.NameKey projectNameKey;
     projectNameKey = Project.NameKey.parse(PROJECT_NAME);
 
diff --git a/src/test/java/com/cisco/gerrit/plugins/slack/message/ChangeMergedMessageGeneratorTest.java b/src/test/java/com/cisco/gerrit/plugins/slack/message/ChangeMergedMessageGeneratorTest.java
index 303b7f3..269c502 100644
--- a/src/test/java/com/cisco/gerrit/plugins/slack/message/ChangeMergedMessageGeneratorTest.java
+++ b/src/test/java/com/cisco/gerrit/plugins/slack/message/ChangeMergedMessageGeneratorTest.java
@@ -31,24 +31,15 @@
 import com.google.gerrit.server.data.AccountAttribute;
 import com.google.gerrit.server.data.ChangeAttribute;
 import com.google.gerrit.server.events.ChangeMergedEvent;
-import org.junit.Before;
 import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
 
 /**
  * Tests for the ChangeMergedMessageGeneratorTest class. The expected behavior is that the
  * ChangeMergedMessageGenerator should publish regardless of a configured ignore pattern.
  */
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({Project.NameKey.class})
 public class ChangeMergedMessageGeneratorTest {
   private static final String PROJECT_NAME = "test-project";
 
-  private Project.NameKey mockNameKey = mock(Project.NameKey.class);
-
   private PluginConfigFactory mockConfigFactory = mock(PluginConfigFactory.class);
 
   private PluginConfig mockPluginConfig = mock(PluginConfig.class);
@@ -57,12 +48,6 @@
   private AccountAttribute mockAccount = mock(AccountAttribute.class);
   private ChangeAttribute mockChange = mock(ChangeAttribute.class);
 
-  @Before
-  public void setup() throws Exception {
-    PowerMockito.mockStatic(Project.NameKey.class);
-    when(Project.NameKey.parse(PROJECT_NAME)).thenReturn(mockNameKey);
-  }
-
   private ProjectConfig getConfig(boolean publishOnChangeMerged) throws Exception {
     Project.NameKey projectNameKey;
     projectNameKey = Project.NameKey.parse(PROJECT_NAME);
diff --git a/src/test/java/com/cisco/gerrit/plugins/slack/message/CommentAddedMessageGeneratorTest.java b/src/test/java/com/cisco/gerrit/plugins/slack/message/CommentAddedMessageGeneratorTest.java
index 159993a..3509311 100644
--- a/src/test/java/com/cisco/gerrit/plugins/slack/message/CommentAddedMessageGeneratorTest.java
+++ b/src/test/java/com/cisco/gerrit/plugins/slack/message/CommentAddedMessageGeneratorTest.java
@@ -31,24 +31,15 @@
 import com.google.gerrit.server.data.AccountAttribute;
 import com.google.gerrit.server.data.ChangeAttribute;
 import com.google.gerrit.server.events.CommentAddedEvent;
-import org.junit.Before;
 import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
 
 /**
  * Tests for the CommentAddedMessageGeneratorTest class. The expected behavior is that the
  * CommentAddedMessageGeneratorTest should publish regardless of a configured ignore pattern.
  */
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({Project.NameKey.class})
 public class CommentAddedMessageGeneratorTest {
   private static final String PROJECT_NAME = "test-project";
 
-  private Project.NameKey mockNameKey = mock(Project.NameKey.class);
-
   private PluginConfigFactory mockConfigFactory = mock(PluginConfigFactory.class);
 
   private PluginConfig mockPluginConfig = mock(PluginConfig.class);
@@ -58,12 +49,6 @@
   private ChangeAttribute mockChange = mock(ChangeAttribute.class);
   private AccountAttribute mockOwner = mock(AccountAttribute.class);
 
-  @Before
-  public void setup() throws Exception {
-    PowerMockito.mockStatic(Project.NameKey.class);
-    when(Project.NameKey.parse(PROJECT_NAME)).thenReturn(mockNameKey);
-  }
-
   private ProjectConfig getConfig(
       boolean publishOnCommentAdded,
       boolean ignoreWorkInProgressPatchSet,
diff --git a/src/test/java/com/cisco/gerrit/plugins/slack/message/PatchSetCreatedMessageGeneratorTest.java b/src/test/java/com/cisco/gerrit/plugins/slack/message/PatchSetCreatedMessageGeneratorTest.java
index 64cbc70..ed47473 100644
--- a/src/test/java/com/cisco/gerrit/plugins/slack/message/PatchSetCreatedMessageGeneratorTest.java
+++ b/src/test/java/com/cisco/gerrit/plugins/slack/message/PatchSetCreatedMessageGeneratorTest.java
@@ -33,16 +33,9 @@
 import com.google.gerrit.server.data.ChangeAttribute;
 import com.google.gerrit.server.data.PatchSetAttribute;
 import com.google.gerrit.server.events.PatchSetCreatedEvent;
-import org.junit.Before;
 import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
 
 /** Tests for the PatchSetCreatedMessageGeneratorTest class. */
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({Project.NameKey.class})
 public class PatchSetCreatedMessageGeneratorTest {
   private static final String PROJECT_NAME = "test-project";
 
@@ -57,12 +50,6 @@
   private ChangeAttribute mockChange = mock(ChangeAttribute.class);
   private PatchSetAttribute mockPatchSet = mock(PatchSetAttribute.class);
 
-  @Before
-  public void setup() throws Exception {
-    PowerMockito.mockStatic(Project.NameKey.class);
-    when(Project.NameKey.parse(PROJECT_NAME)).thenReturn(mockNameKey);
-  }
-
   private ProjectConfig getConfig(
       String ignore,
       boolean publishOnPatchSetCreated,
diff --git a/src/test/java/com/cisco/gerrit/plugins/slack/message/PrivateStateChangedGeneratorTest.java b/src/test/java/com/cisco/gerrit/plugins/slack/message/PrivateStateChangedGeneratorTest.java
index c9684cb..f2695cf 100644
--- a/src/test/java/com/cisco/gerrit/plugins/slack/message/PrivateStateChangedGeneratorTest.java
+++ b/src/test/java/com/cisco/gerrit/plugins/slack/message/PrivateStateChangedGeneratorTest.java
@@ -31,24 +31,15 @@
 import com.google.gerrit.server.data.AccountAttribute;
 import com.google.gerrit.server.data.ChangeAttribute;
 import com.google.gerrit.server.events.PrivateStateChangedEvent;
-import org.junit.Before;
 import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
 
 /**
  * Tests for the PrivateStateChangedGenerator class. The expected behavior is that the
  * PrivateStateChangedGenerator should publish when the state changes.
  */
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({Project.NameKey.class})
 public class PrivateStateChangedGeneratorTest {
   private static final String PROJECT_NAME = "test-project";
 
-  private Project.NameKey mockNameKey = mock(Project.NameKey.class);
-
   private PluginConfigFactory mockConfigFactory = mock(PluginConfigFactory.class);
 
   private PluginConfig mockPluginConfig = mock(PluginConfig.class);
@@ -57,12 +48,6 @@
   private AccountAttribute mockAccount = mock(AccountAttribute.class);
   private ChangeAttribute mockChange = mock(ChangeAttribute.class);
 
-  @Before
-  public void setup() throws Exception {
-    PowerMockito.mockStatic(Project.NameKey.class);
-    when(Project.NameKey.parse(PROJECT_NAME)).thenReturn(mockNameKey);
-  }
-
   private ProjectConfig getConfig(boolean publishOnPrivateToPublic) throws Exception {
     Project.NameKey projectNameKey;
     projectNameKey = Project.NameKey.parse(PROJECT_NAME);
diff --git a/src/test/java/com/cisco/gerrit/plugins/slack/message/ReviewerAddedMessageGeneratorTest.java b/src/test/java/com/cisco/gerrit/plugins/slack/message/ReviewerAddedMessageGeneratorTest.java
index c41c92e..ebd6816 100644
--- a/src/test/java/com/cisco/gerrit/plugins/slack/message/ReviewerAddedMessageGeneratorTest.java
+++ b/src/test/java/com/cisco/gerrit/plugins/slack/message/ReviewerAddedMessageGeneratorTest.java
@@ -31,25 +31,16 @@
 import com.google.gerrit.server.data.AccountAttribute;
 import com.google.gerrit.server.data.ChangeAttribute;
 import com.google.gerrit.server.events.ReviewerAddedEvent;
-import org.junit.Before;
 import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
 
 /**
  * Tests for the ReviewerAddedMessageGeneratorTest class. The expected behavior is that the
  * ReviewerAddedMessageGeneratorTest should publish if both the plugin and publish-on-reviewer-added
  * are enabled.
  */
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({Project.NameKey.class})
 public class ReviewerAddedMessageGeneratorTest {
   private static final String PROJECT_NAME = "test-project";
 
-  private Project.NameKey mockNameKey = mock(Project.NameKey.class);
-
   private PluginConfigFactory mockConfigFactory = mock(PluginConfigFactory.class);
 
   private PluginConfig mockPluginConfig = mock(PluginConfig.class);
@@ -58,12 +49,6 @@
   private AccountAttribute mockAccount = mock(AccountAttribute.class);
   private ChangeAttribute mockChange = mock(ChangeAttribute.class);
 
-  @Before
-  public void setup() throws Exception {
-    PowerMockito.mockStatic(Project.NameKey.class);
-    when(Project.NameKey.parse(PROJECT_NAME)).thenReturn(mockNameKey);
-  }
-
   private ProjectConfig getConfig(
       boolean publishOnReviewerAdded,
       boolean ignoreWorkInProgressPatchSet,
diff --git a/src/test/java/com/cisco/gerrit/plugins/slack/message/WorkInProgressStateChangedGeneratorTest.java b/src/test/java/com/cisco/gerrit/plugins/slack/message/WorkInProgressStateChangedGeneratorTest.java
index 33accac..afa7211 100644
--- a/src/test/java/com/cisco/gerrit/plugins/slack/message/WorkInProgressStateChangedGeneratorTest.java
+++ b/src/test/java/com/cisco/gerrit/plugins/slack/message/WorkInProgressStateChangedGeneratorTest.java
@@ -31,19 +31,12 @@
 import com.google.gerrit.server.data.AccountAttribute;
 import com.google.gerrit.server.data.ChangeAttribute;
 import com.google.gerrit.server.events.WorkInProgressStateChangedEvent;
-import org.junit.Before;
 import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
 
 /**
  * Tests for the WorkInProgressStateChangedGenerator class. The expected behavior is that the
  * WorkInProgressStateChangedGenerator should publish when the state changes.
  */
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({Project.NameKey.class})
 public class WorkInProgressStateChangedGeneratorTest {
   private static final String PROJECT_NAME = "test-project";
 
@@ -57,12 +50,6 @@
   private AccountAttribute mockAccount = mock(AccountAttribute.class);
   private ChangeAttribute mockChange = mock(ChangeAttribute.class);
 
-  @Before
-  public void setup() throws Exception {
-    PowerMockito.mockStatic(Project.NameKey.class);
-    when(Project.NameKey.parse(PROJECT_NAME)).thenReturn(mockNameKey);
-  }
-
   private ProjectConfig getConfig(boolean publishOnWipReady) throws Exception {
     Project.NameKey projectNameKey;
     projectNameKey = Project.NameKey.parse(PROJECT_NAME);