Migrate from easymock to mockito

Change-Id: Ia78e3b56547313f8d3ef5bd70d200e62024d8815
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/its/ItsConfigTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/its/ItsConfigTest.java
index 92eb61f..3379908 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/its/ItsConfigTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/its/ItsConfigTest.java
@@ -14,8 +14,11 @@
 
 package com.googlesource.gerrit.plugins.its.base.its;
 
-import static org.easymock.EasyMock.eq;
-import static org.easymock.EasyMock.expect;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.atLeastOnce;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 import com.google.common.base.Suppliers;
 import com.google.gerrit.entities.Project;
@@ -51,57 +54,53 @@
 
   public void setupIsEnabled(
       String enabled, String itsProject, String parentEnabled, String[] branches) {
-    ProjectState projectState = createMock(ProjectState.class);
+    ProjectState projectState = mock(ProjectState.class);
 
-    expect(projectCache.get(Project.nameKey("testProject"))).andReturn(projectState).anyTimes();
-    expect(projectCache.get(Project.nameKey("parentProject"))).andReturn(projectState).anyTimes();
+    when(projectCache.get(Project.nameKey("testProject"))).thenReturn(projectState);
+    when(projectCache.get(Project.nameKey("parentProject"))).thenReturn(projectState);
 
     Iterable<ProjectState> parents;
     if (parentEnabled == null) {
       parents = Arrays.asList(projectState);
     } else {
-      ProjectState parentProjectState = createMock(ProjectState.class);
+      ProjectState parentProjectState = mock(ProjectState.class);
 
-      PluginConfig parentPluginConfig = createMock(PluginConfig.class);
+      PluginConfig parentPluginConfig = mock(PluginConfig.class);
 
-      expect(pluginConfigFactory.getFromProjectConfig(parentProjectState, "ItsTestName"))
-          .andReturn(parentPluginConfig);
+      when(pluginConfigFactory.getFromProjectConfig(parentProjectState, "ItsTestName"))
+          .thenReturn(parentPluginConfig);
 
-      expect(parentPluginConfig.getString("enabled", "false")).andReturn(parentEnabled).anyTimes();
+      when(parentPluginConfig.getString("enabled", "false")).thenReturn(parentEnabled);
 
-      PluginConfig parentPluginConfigWI = createMock(PluginConfig.class);
+      PluginConfig parentPluginConfigWI = mock(PluginConfig.class);
 
-      expect(
-              pluginConfigFactory.getFromProjectConfigWithInheritance(
-                  parentProjectState, "ItsTestName"))
-          .andReturn(parentPluginConfigWI)
-          .anyTimes();
+      when(pluginConfigFactory.getFromProjectConfigWithInheritance(
+              parentProjectState, "ItsTestName"))
+          .thenReturn(parentPluginConfigWI);
 
       String[] parentBranches = {"refs/heads/testBranch"};
-      expect(parentPluginConfigWI.getStringList("branch")).andReturn(parentBranches).anyTimes();
+      when(parentPluginConfigWI.getStringList("branch")).thenReturn(parentBranches);
 
       parents = Arrays.asList(parentProjectState, projectState);
     }
-    expect(projectState.treeInOrder()).andReturn(parents).anyTimes();
+    when(projectState.treeInOrder()).thenReturn(parents);
 
-    PluginConfig pluginConfig = createMock(PluginConfig.class);
+    PluginConfig pluginConfig = mock(PluginConfig.class);
 
-    expect(pluginConfigFactory.getFromProjectConfig(projectState, "ItsTestName"))
-        .andReturn(pluginConfig)
-        .anyTimes();
+    when(pluginConfigFactory.getFromProjectConfig(projectState, "ItsTestName"))
+        .thenReturn(pluginConfig);
 
-    expect(pluginConfig.getString("enabled", "false")).andReturn(enabled).anyTimes();
-    expect(pluginConfig.getString(eq("its-project"))).andReturn(itsProject).anyTimes();
+    when(pluginConfig.getString("enabled", "false")).thenReturn(enabled);
+    when(pluginConfig.getString(eq("its-project"))).thenReturn(itsProject);
 
-    PluginConfig pluginConfigWI = createMock(PluginConfig.class);
+    PluginConfig pluginConfigWI = mock(PluginConfig.class);
 
-    expect(pluginConfigFactory.getFromProjectConfigWithInheritance(projectState, "ItsTestName"))
-        .andReturn(pluginConfigWI)
-        .anyTimes();
+    when(pluginConfigFactory.getFromProjectConfigWithInheritance(projectState, "ItsTestName"))
+        .thenReturn(pluginConfigWI);
 
-    expect(pluginConfigWI.getString("enabled", "false")).andReturn(enabled).anyTimes();
+    when(pluginConfigWI.getString("enabled", "false")).thenReturn(enabled);
 
-    expect(pluginConfigWI.getStringList("branch")).andReturn(branches).anyTimes();
+    when(pluginConfigWI.getStringList("branch")).thenReturn(branches);
   }
 
   public void testIsEnabledRefNoParentNoBranchEnabled() {
@@ -110,8 +109,6 @@
 
     ItsConfig itsConfig = createItsConfig();
 
-    replayMocks();
-
     Project.NameKey projectNK = Project.nameKey("testProject");
     assertTrue(itsConfig.isEnabled(projectNK, "refs/heads/testBranch"));
   }
@@ -122,8 +119,6 @@
 
     ItsConfig itsConfig = createItsConfig();
 
-    replayMocks();
-
     Project.NameKey projectNK = Project.nameKey("testProject");
     assertFalse(itsConfig.isEnabled(projectNK, "refs/heads/testBranch"));
   }
@@ -134,8 +129,6 @@
 
     ItsConfig itsConfig = createItsConfig();
 
-    replayMocks();
-
     Project.NameKey projectNK = Project.nameKey("testProject");
     assertTrue(itsConfig.isEnabled(projectNK, "refs/heads/testBranch"));
   }
@@ -146,8 +139,6 @@
 
     ItsConfig itsConfig = createItsConfig();
 
-    replayMocks();
-
     Project.NameKey projectNK = Project.nameKey("testProject");
     assertTrue(itsConfig.isEnabled(projectNK, "refs/heads/testBranch"));
   }
@@ -158,8 +149,6 @@
 
     ItsConfig itsConfig = createItsConfig();
 
-    replayMocks();
-
     Project.NameKey projectNK = Project.nameKey("testProject");
     assertFalse(itsConfig.isEnabled(projectNK, "refs/heads/testBranch"));
   }
@@ -170,8 +159,6 @@
 
     ItsConfig itsConfig = createItsConfig();
 
-    replayMocks();
-
     Project.NameKey projectNK = Project.nameKey("testProject");
     assertTrue(itsConfig.isEnabled(projectNK, "refs/heads/testBranch"));
   }
@@ -182,8 +169,6 @@
 
     ItsConfig itsConfig = createItsConfig();
 
-    replayMocks();
-
     Project.NameKey projectNK = Project.nameKey("testProject");
     assertFalse(itsConfig.isEnabled(projectNK, "refs/heads/testBranch"));
   }
@@ -194,8 +179,6 @@
 
     ItsConfig itsConfig = createItsConfig();
 
-    replayMocks();
-
     Project.NameKey projectNK = Project.nameKey("testProject");
     assertFalse(itsConfig.isEnabled(projectNK, "refs/heads/testBranch"));
   }
@@ -206,8 +189,6 @@
 
     ItsConfig itsConfig = createItsConfig();
 
-    replayMocks();
-
     Project.NameKey projectNK = Project.nameKey("testProject");
     assertFalse(itsConfig.isEnabled(projectNK, "refs/heads/testBranch"));
   }
@@ -218,8 +199,6 @@
 
     ItsConfig itsConfig = createItsConfig();
 
-    replayMocks();
-
     Project.NameKey projectNK = Project.nameKey("testProject");
     assertTrue(itsConfig.isEnabled(projectNK, "refs/heads/testBranch"));
   }
@@ -230,8 +209,6 @@
 
     ItsConfig itsConfig = createItsConfig();
 
-    replayMocks();
-
     Project.NameKey projectNK = Project.nameKey("testProject");
     assertFalse(itsConfig.isEnabled(projectNK, "refs/heads/testBranch"));
   }
@@ -242,8 +219,6 @@
 
     ItsConfig itsConfig = createItsConfig();
 
-    replayMocks();
-
     Project.NameKey projectNK = Project.nameKey("testProject");
     assertTrue(itsConfig.isEnabled(projectNK, "refs/heads/testBranch"));
   }
@@ -254,8 +229,6 @@
 
     ItsConfig itsConfig = createItsConfig();
 
-    replayMocks();
-
     Project.NameKey projectNK = Project.nameKey("testProject");
     assertFalse(itsConfig.isEnabled(projectNK, "refs/heads/testBranch"));
   }
@@ -266,8 +239,6 @@
 
     ItsConfig itsConfig = createItsConfig();
 
-    replayMocks();
-
     Project.NameKey projectNK = Project.nameKey("testProject");
     assertFalse(itsConfig.isEnabled(projectNK, "refs/heads/testBranch"));
   }
@@ -278,8 +249,6 @@
 
     ItsConfig itsConfig = createItsConfig();
 
-    replayMocks();
-
     Project.NameKey projectNK = Project.nameKey("testProject");
     assertTrue(itsConfig.isEnabled(projectNK, "refs/heads/testBranch"));
   }
@@ -292,8 +261,6 @@
 
     ItsConfig itsConfig = createItsConfig();
 
-    replayMocks();
-
     assertTrue(itsConfig.isEnabled(event));
   }
 
@@ -305,8 +272,6 @@
 
     ItsConfig itsConfig = createItsConfig();
 
-    replayMocks();
-
     assertTrue(itsConfig.isEnabled(event));
   }
 
@@ -318,8 +283,6 @@
 
     ItsConfig itsConfig = createItsConfig();
 
-    replayMocks();
-
     assertTrue(itsConfig.isEnabled(event));
   }
 
@@ -331,8 +294,6 @@
 
     ItsConfig itsConfig = createItsConfig();
 
-    replayMocks();
-
     assertFalse(itsConfig.isEnabled(event));
   }
 
@@ -344,8 +305,6 @@
 
     ItsConfig itsConfig = createItsConfig();
 
-    replayMocks();
-
     assertTrue(itsConfig.isEnabled(event));
   }
 
@@ -357,8 +316,6 @@
 
     ItsConfig itsConfig = createItsConfig();
 
-    replayMocks();
-
     assertTrue(itsConfig.isEnabled(event));
   }
 
@@ -370,8 +327,6 @@
 
     ItsConfig itsConfig = createItsConfig();
 
-    replayMocks();
-
     assertTrue(itsConfig.isEnabled(event));
   }
 
@@ -383,8 +338,6 @@
 
     ItsConfig itsConfig = createItsConfig();
 
-    replayMocks();
-
     assertTrue(itsConfig.isEnabled(event));
   }
 
@@ -396,8 +349,6 @@
 
     ItsConfig itsConfig = createItsConfig();
 
-    replayMocks();
-
     assertFalse(itsConfig.isEnabled(event));
   }
 
@@ -409,8 +360,6 @@
 
     ItsConfig itsConfig = createItsConfig();
 
-    replayMocks();
-
     assertTrue(itsConfig.isEnabled(event));
   }
 
@@ -422,8 +371,6 @@
 
     ItsConfig itsConfig = createItsConfig();
 
-    replayMocks();
-
     assertTrue(itsConfig.isEnabled(event));
   }
 
@@ -435,8 +382,6 @@
 
     ItsConfig itsConfig = createItsConfig();
 
-    replayMocks();
-
     assertTrue(itsConfig.isEnabled(event));
   }
 
@@ -448,8 +393,6 @@
 
     ItsConfig itsConfig = createItsConfig();
 
-    replayMocks();
-
     assertTrue(itsConfig.isEnabled(event));
   }
 
@@ -465,18 +408,14 @@
 
     ItsConfig itsConfig = createItsConfig();
 
-    replayMocks();
-
     assertTrue(itsConfig.isEnabled(event));
   }
 
   public void BROKEN_testIsEnabledUnknownEvent() {
-    RefEvent event = createMock(RefEvent.class);
+    RefEvent event = mock(RefEvent.class);
 
     ItsConfig itsConfig = createItsConfig();
 
-    replayMocks();
-
     assertFalse(itsConfig.isEnabled(event));
     assertLogMessageContains("not recognised and ignored");
   }
@@ -487,8 +426,6 @@
 
     ItsConfig itsConfig = createItsConfig();
 
-    replayMocks();
-
     assertFalse(itsConfig.getItsProjectName(Project.nameKey("testProject")).isPresent());
   }
 
@@ -498,8 +435,6 @@
 
     ItsConfig itsConfig = createItsConfig();
 
-    replayMocks();
-
     Optional<String> itsProjectName = itsConfig.getItsProjectName(Project.nameKey("testProject"));
     assertTrue(itsProjectName.isPresent());
     assertEquals("itsProject", itsProjectName.get());
@@ -508,328 +443,280 @@
   public void testGetIssuePatternNullMatch() {
     ItsConfig itsConfig = createItsConfig();
 
-    expect(serverConfig.getString("plugin", "ItsTestName", "commentlink"))
-        .andReturn(null)
-        .atLeastOnce();
-    expect(serverConfig.getString("commentlink", "ItsTestName", "match"))
-        .andReturn(null)
-        .atLeastOnce();
-
-    replayMocks();
-
     assertNull("Pattern for null match is not null", itsConfig.getIssuePattern());
+
+    verifyOneOrMore(serverConfig).getString("plugin", "ItsTestName", "commentlink");
+    verifyOneOrMore(serverConfig).getString("commentlink", "ItsTestName", "match");
   }
 
   public void testGetIssuePatternNullMatchWCommentLink() {
     ItsConfig itsConfig = createItsConfig();
 
-    expect(serverConfig.getString("plugin", "ItsTestName", "commentlink"))
-        .andReturn("foo")
-        .atLeastOnce();
-    expect(serverConfig.getString("commentlink", "foo", "match")).andReturn(null).atLeastOnce();
-
-    replayMocks();
+    when(serverConfig.getString("plugin", "ItsTestName", "commentlink")).thenReturn("foo");
 
     assertNull("Pattern for null match is not null", itsConfig.getIssuePattern());
+
+    verifyOneOrMore(serverConfig).getString("plugin", "ItsTestName", "commentlink");
+    verifyOneOrMore(serverConfig).getString("commentlink", "foo", "match");
   }
 
   public void testGetIssuePattern() {
     ItsConfig itsConfig = createItsConfig();
 
-    expect(serverConfig.getString("plugin", "ItsTestName", "commentlink"))
-        .andReturn(null)
-        .atLeastOnce();
-    expect(serverConfig.getString("commentlink", "ItsTestName", "match"))
-        .andReturn("TestPattern")
-        .atLeastOnce();
-
-    replayMocks();
+    when(serverConfig.getString("commentlink", "ItsTestName", "match")).thenReturn("TestPattern");
 
     assertEquals(
         "Expected and generated pattern are not equal",
         "TestPattern",
         itsConfig.getIssuePattern().pattern());
+
+    verifyOneOrMore(serverConfig).getString("plugin", "ItsTestName", "commentlink");
+    verifyOneOrMore(serverConfig).getString("commentlink", "ItsTestName", "match");
   }
 
   public void testGetIssuePatternWCommentLink() {
     ItsConfig itsConfig = createItsConfig();
 
-    expect(serverConfig.getString("plugin", "ItsTestName", "commentlink"))
-        .andReturn("foo")
-        .atLeastOnce();
-    expect(serverConfig.getString("commentlink", "foo", "match"))
-        .andReturn("TestPattern")
-        .atLeastOnce();
-
-    replayMocks();
+    when(serverConfig.getString("plugin", "ItsTestName", "commentlink")).thenReturn("foo");
+    when(serverConfig.getString("commentlink", "foo", "match")).thenReturn("TestPattern");
 
     assertEquals(
         "Expected and generated pattern are not equal",
         "TestPattern",
         itsConfig.getIssuePattern().pattern());
+
+    verifyOneOrMore(serverConfig).getString("plugin", "ItsTestName", "commentlink");
+    verifyOneOrMore(serverConfig).getString("commentlink", "foo", "match");
   }
 
   public void testGetIssuePatternGroupIndexGroupDefault() {
     ItsConfig itsConfig = createItsConfig();
 
-    expect(serverConfig.getString("plugin", "ItsTestName", "commentlink"))
-        .andReturn(null)
-        .atLeastOnce();
-    expect(serverConfig.getString("commentlink", "ItsTestName", "match"))
-        .andReturn("(foo)(bar)(baz)")
-        .atLeastOnce();
-    expect(serverConfig.getInt("plugin", "ItsTestName", "commentlinkGroupIndex", 1))
-        .andReturn(1)
-        .atLeastOnce();
-
-    replayMocks();
+    when(serverConfig.getString("commentlink", "ItsTestName", "match"))
+        .thenReturn("(foo)(bar)(baz)");
+    when(serverConfig.getInt("plugin", "ItsTestName", "commentlinkGroupIndex", 1)).thenReturn(1);
 
     assertEquals(
         "Expected and actual group index do not match", 1, itsConfig.getIssuePatternGroupIndex());
+
+    verifyOneOrMore(serverConfig).getString("plugin", "ItsTestName", "commentlink");
+    verifyOneOrMore(serverConfig).getString("commentlink", "ItsTestName", "match");
+    verifyOneOrMore(serverConfig).getInt("plugin", "ItsTestName", "commentlinkGroupIndex", 1);
   }
 
   public void testGetIssuePatternGroupIndexGroupDefaultGroupless() {
     ItsConfig itsConfig = createItsConfig();
 
-    expect(serverConfig.getString("plugin", "ItsTestName", "commentlink"))
-        .andReturn(null)
-        .atLeastOnce();
-    expect(serverConfig.getString("commentlink", "ItsTestName", "match"))
-        .andReturn("foo")
-        .atLeastOnce();
-    expect(serverConfig.getInt("plugin", "ItsTestName", "commentlinkGroupIndex", 1))
-        .andReturn(1)
-        .atLeastOnce();
-
-    replayMocks();
+    when(serverConfig.getString("commentlink", "ItsTestName", "match")).thenReturn("foo");
+    when(serverConfig.getInt("plugin", "ItsTestName", "commentlinkGroupIndex", 1)).thenReturn(1);
 
     assertEquals(
         "Expected and actual group index do not match", 0, itsConfig.getIssuePatternGroupIndex());
+
+    verifyOneOrMore(serverConfig).getString("plugin", "ItsTestName", "commentlink");
+    verifyOneOrMore(serverConfig).getString("commentlink", "ItsTestName", "match");
+    verifyOneOrMore(serverConfig).getInt("plugin", "ItsTestName", "commentlinkGroupIndex", 1);
   }
 
   public void testGetIssuePatternGroupIndexGroup1() {
     ItsConfig itsConfig = createItsConfig();
 
-    expect(serverConfig.getString("plugin", "ItsTestName", "commentlink"))
-        .andReturn(null)
-        .atLeastOnce();
-    expect(serverConfig.getString("commentlink", "ItsTestName", "match"))
-        .andReturn("(foo)(bar)(baz)")
-        .atLeastOnce();
-    expect(serverConfig.getInt("plugin", "ItsTestName", "commentlinkGroupIndex", 1))
-        .andReturn(1)
-        .atLeastOnce();
-
-    replayMocks();
+    when(serverConfig.getString("commentlink", "ItsTestName", "match"))
+        .thenReturn("(foo)(bar)(baz)");
+    when(serverConfig.getInt("plugin", "ItsTestName", "commentlinkGroupIndex", 1)).thenReturn(1);
 
     assertEquals(
         "Expected and actual group index do not match", 1, itsConfig.getIssuePatternGroupIndex());
+
+    verifyOneOrMore(serverConfig).getString("plugin", "ItsTestName", "commentlink");
+    verifyOneOrMore(serverConfig).getString("commentlink", "ItsTestName", "match");
+    verifyOneOrMore(serverConfig).getInt("plugin", "ItsTestName", "commentlinkGroupIndex", 1);
   }
 
   public void testGetIssuePatternGroupIndexGroup3() {
     ItsConfig itsConfig = createItsConfig();
 
-    expect(serverConfig.getString("plugin", "ItsTestName", "commentlink"))
-        .andReturn(null)
-        .atLeastOnce();
-    expect(serverConfig.getString("commentlink", "ItsTestName", "match"))
-        .andReturn("(foo)(bar)(baz)")
-        .atLeastOnce();
-    expect(serverConfig.getInt("plugin", "ItsTestName", "commentlinkGroupIndex", 1))
-        .andReturn(3)
-        .atLeastOnce();
-
-    replayMocks();
+    when(serverConfig.getString("commentlink", "ItsTestName", "match"))
+        .thenReturn("(foo)(bar)(baz)");
+    when(serverConfig.getInt("plugin", "ItsTestName", "commentlinkGroupIndex", 1)).thenReturn(3);
 
     assertEquals(
         "Expected and actual group index do not match", 3, itsConfig.getIssuePatternGroupIndex());
+
+    verifyOneOrMore(serverConfig).getString("plugin", "ItsTestName", "commentlink");
+    verifyOneOrMore(serverConfig).getString("commentlink", "ItsTestName", "match");
+    verifyOneOrMore(serverConfig).getInt("plugin", "ItsTestName", "commentlinkGroupIndex", 1);
   }
 
   public void testGetIssuePatternGroupIndexGroupTooHigh() {
     ItsConfig itsConfig = createItsConfig();
 
-    expect(serverConfig.getString("plugin", "ItsTestName", "commentlink"))
-        .andReturn(null)
-        .atLeastOnce();
-    expect(serverConfig.getString("commentlink", "ItsTestName", "match"))
-        .andReturn("(foo)(bar)(baz)")
-        .atLeastOnce();
-    expect(serverConfig.getInt("plugin", "ItsTestName", "commentlinkGroupIndex", 1))
-        .andReturn(5)
-        .atLeastOnce();
-
-    replayMocks();
+    when(serverConfig.getString("commentlink", "ItsTestName", "match"))
+        .thenReturn("(foo)(bar)(baz)");
+    when(serverConfig.getInt("plugin", "ItsTestName", "commentlinkGroupIndex", 1)).thenReturn(5);
 
     assertEquals(
         "Expected and actual group index do not match", 1, itsConfig.getIssuePatternGroupIndex());
+
+    verifyOneOrMore(serverConfig).getString("plugin", "ItsTestName", "commentlink");
+    verifyOneOrMore(serverConfig).getString("commentlink", "ItsTestName", "match");
+    verifyOneOrMore(serverConfig).getInt("plugin", "ItsTestName", "commentlinkGroupIndex", 1);
   }
 
   public void testGetIssuePatternGroupIndexGroupTooHighGroupless() {
     ItsConfig itsConfig = createItsConfig();
 
-    expect(serverConfig.getString("plugin", "ItsTestName", "commentlink"))
-        .andReturn(null)
-        .atLeastOnce();
-    expect(serverConfig.getString("commentlink", "ItsTestName", "match"))
-        .andReturn("foo")
-        .atLeastOnce();
-    expect(serverConfig.getInt("plugin", "ItsTestName", "commentlinkGroupIndex", 1))
-        .andReturn(5)
-        .atLeastOnce();
-
-    replayMocks();
+    when(serverConfig.getString("commentlink", "ItsTestName", "match")).thenReturn("foo");
+    when(serverConfig.getInt("plugin", "ItsTestName", "commentlinkGroupIndex", 1)).thenReturn(5);
 
     assertEquals(
         "Expected and actual group index do not match", 0, itsConfig.getIssuePatternGroupIndex());
+
+    verifyOneOrMore(serverConfig).getString("plugin", "ItsTestName", "commentlink");
+    verifyOneOrMore(serverConfig).getString("commentlink", "ItsTestName", "match");
+    verifyOneOrMore(serverConfig).getInt("plugin", "ItsTestName", "commentlinkGroupIndex", 1);
   }
 
   public void testGetItsAssociationPolicyOptional() {
     ItsConfig itsConfig = createItsConfig();
 
-    expect(serverConfig.getString("plugin", "ItsTestName", "commentlink"))
-        .andReturn(null)
-        .atLeastOnce();
-    expect(
-            serverConfig.getEnum(
-                "commentlink", "ItsTestName", "association", ItsAssociationPolicy.OPTIONAL))
-        .andReturn(ItsAssociationPolicy.OPTIONAL)
-        .atLeastOnce();
-    expect(
-            serverConfig.getEnum(
-                "plugin", "ItsTestName", "association", ItsAssociationPolicy.OPTIONAL))
-        .andReturn(ItsAssociationPolicy.OPTIONAL)
-        .atLeastOnce();
-
-    replayMocks();
+    when(serverConfig.getEnum(
+            "commentlink", "ItsTestName", "association", ItsAssociationPolicy.OPTIONAL))
+        .thenReturn(ItsAssociationPolicy.OPTIONAL);
+    when(serverConfig.getEnum(
+            "plugin", "ItsTestName", "association", ItsAssociationPolicy.OPTIONAL))
+        .thenReturn(ItsAssociationPolicy.OPTIONAL);
 
     assertEquals(
         "Expected and generated associated policy do not match",
         ItsAssociationPolicy.OPTIONAL,
         itsConfig.getItsAssociationPolicy());
+
+    verifyOneOrMore(serverConfig).getString("plugin", "ItsTestName", "commentlink");
+    verifyOneOrMore(serverConfig)
+        .getEnum("commentlink", "ItsTestName", "association", ItsAssociationPolicy.OPTIONAL);
+    verifyOneOrMore(serverConfig)
+        .getEnum("plugin", "ItsTestName", "association", ItsAssociationPolicy.OPTIONAL);
   }
 
   public void testGetItsAssociationPolicyOptionalWCommentLink() {
     ItsConfig itsConfig = createItsConfig();
 
-    expect(serverConfig.getString("plugin", "ItsTestName", "commentlink"))
-        .andReturn("foo")
-        .atLeastOnce();
-    expect(serverConfig.getEnum("commentlink", "foo", "association", ItsAssociationPolicy.OPTIONAL))
-        .andReturn(ItsAssociationPolicy.OPTIONAL)
-        .atLeastOnce();
-    expect(
-            serverConfig.getEnum(
-                "plugin", "ItsTestName", "association", ItsAssociationPolicy.OPTIONAL))
-        .andReturn(ItsAssociationPolicy.OPTIONAL)
-        .atLeastOnce();
-
-    replayMocks();
+    when(serverConfig.getString("plugin", "ItsTestName", "commentlink")).thenReturn("foo");
+    when(serverConfig.getEnum("commentlink", "foo", "association", ItsAssociationPolicy.OPTIONAL))
+        .thenReturn(ItsAssociationPolicy.OPTIONAL);
+    when(serverConfig.getEnum(
+            "plugin", "ItsTestName", "association", ItsAssociationPolicy.OPTIONAL))
+        .thenReturn(ItsAssociationPolicy.OPTIONAL);
 
     assertEquals(
         "Expected and generated associated policy do not match",
         ItsAssociationPolicy.OPTIONAL,
         itsConfig.getItsAssociationPolicy());
+
+    verifyOneOrMore(serverConfig).getString("plugin", "ItsTestName", "commentlink");
+    verifyOneOrMore(serverConfig)
+        .getEnum("commentlink", "foo", "association", ItsAssociationPolicy.OPTIONAL);
+    verifyOneOrMore(serverConfig)
+        .getEnum("plugin", "ItsTestName", "association", ItsAssociationPolicy.OPTIONAL);
   }
 
   public void testGetItsAssociationPolicySuggested() {
     ItsConfig itsConfig = createItsConfig();
 
-    expect(serverConfig.getString("plugin", "ItsTestName", "commentlink"))
-        .andReturn(null)
-        .atLeastOnce();
-    expect(
-            serverConfig.getEnum(
-                "commentlink", "ItsTestName", "association", ItsAssociationPolicy.OPTIONAL))
-        .andReturn(ItsAssociationPolicy.SUGGESTED)
-        .atLeastOnce();
-    expect(
-            serverConfig.getEnum(
-                "plugin", "ItsTestName", "association", ItsAssociationPolicy.SUGGESTED))
-        .andReturn(ItsAssociationPolicy.SUGGESTED)
-        .atLeastOnce();
-    replayMocks();
+    when(serverConfig.getEnum(
+            "commentlink", "ItsTestName", "association", ItsAssociationPolicy.OPTIONAL))
+        .thenReturn(ItsAssociationPolicy.SUGGESTED);
+    when(serverConfig.getEnum(
+            "plugin", "ItsTestName", "association", ItsAssociationPolicy.SUGGESTED))
+        .thenReturn(ItsAssociationPolicy.SUGGESTED);
 
     assertEquals(
         "Expected and generated associated policy do not match",
         ItsAssociationPolicy.SUGGESTED,
         itsConfig.getItsAssociationPolicy());
+
+    verifyOneOrMore(serverConfig).getString("plugin", "ItsTestName", "commentlink");
+    verifyOneOrMore(serverConfig)
+        .getEnum("commentlink", "ItsTestName", "association", ItsAssociationPolicy.OPTIONAL);
+    verifyOneOrMore(serverConfig)
+        .getEnum("plugin", "ItsTestName", "association", ItsAssociationPolicy.SUGGESTED);
   }
 
   public void testGetItsAssociationPolicySuggestedWCommentLink() {
     ItsConfig itsConfig = createItsConfig();
 
-    expect(serverConfig.getString("plugin", "ItsTestName", "commentlink"))
-        .andReturn("foo")
-        .atLeastOnce();
-    expect(
-            serverConfig.getEnum(
-                "plugin", "ItsTestName", "association", ItsAssociationPolicy.SUGGESTED))
-        .andReturn(ItsAssociationPolicy.SUGGESTED)
-        .atLeastOnce();
-    expect(serverConfig.getEnum("commentlink", "foo", "association", ItsAssociationPolicy.OPTIONAL))
-        .andReturn(ItsAssociationPolicy.SUGGESTED)
-        .atLeastOnce();
-
-    replayMocks();
+    when(serverConfig.getString("plugin", "ItsTestName", "commentlink")).thenReturn("foo");
+    when(serverConfig.getEnum(
+            "plugin", "ItsTestName", "association", ItsAssociationPolicy.SUGGESTED))
+        .thenReturn(ItsAssociationPolicy.SUGGESTED);
+    when(serverConfig.getEnum("commentlink", "foo", "association", ItsAssociationPolicy.OPTIONAL))
+        .thenReturn(ItsAssociationPolicy.SUGGESTED);
 
     assertEquals(
         "Expected and generated associated policy do not match",
         ItsAssociationPolicy.SUGGESTED,
         itsConfig.getItsAssociationPolicy());
+
+    verifyOneOrMore(serverConfig).getString("plugin", "ItsTestName", "commentlink");
+    verifyOneOrMore(serverConfig)
+        .getEnum("plugin", "ItsTestName", "association", ItsAssociationPolicy.SUGGESTED);
+    verifyOneOrMore(serverConfig)
+        .getEnum("commentlink", "foo", "association", ItsAssociationPolicy.OPTIONAL);
   }
 
   public void testGetItsAssociationPolicyMandatory() {
     ItsConfig itsConfig = createItsConfig();
 
-    expect(serverConfig.getString("plugin", "ItsTestName", "commentlink"))
-        .andReturn(null)
-        .atLeastOnce();
-    expect(
-            serverConfig.getEnum(
-                "commentlink", "ItsTestName", "association", ItsAssociationPolicy.OPTIONAL))
-        .andReturn(ItsAssociationPolicy.MANDATORY)
-        .atLeastOnce();
-    expect(
-            serverConfig.getEnum(
-                "plugin", "ItsTestName", "association", ItsAssociationPolicy.MANDATORY))
-        .andReturn(ItsAssociationPolicy.MANDATORY)
-        .atLeastOnce();
-
-    replayMocks();
+    when(serverConfig.getEnum(
+            "commentlink", "ItsTestName", "association", ItsAssociationPolicy.OPTIONAL))
+        .thenReturn(ItsAssociationPolicy.MANDATORY);
+    when(serverConfig.getEnum(
+            "plugin", "ItsTestName", "association", ItsAssociationPolicy.MANDATORY))
+        .thenReturn(ItsAssociationPolicy.MANDATORY);
 
     assertEquals(
         "Expected and generated associated policy do not match",
         ItsAssociationPolicy.MANDATORY,
         itsConfig.getItsAssociationPolicy());
+
+    verifyOneOrMore(serverConfig).getString("plugin", "ItsTestName", "commentlink");
+    verifyOneOrMore(serverConfig)
+        .getEnum("commentlink", "ItsTestName", "association", ItsAssociationPolicy.OPTIONAL);
+    verifyOneOrMore(serverConfig)
+        .getEnum("plugin", "ItsTestName", "association", ItsAssociationPolicy.MANDATORY);
   }
 
   public void testGetItsAssociationPolicyMandatoryWCommentLink() {
     ItsConfig itsConfig = createItsConfig();
 
-    expect(serverConfig.getString("plugin", "ItsTestName", "commentlink"))
-        .andReturn("foo")
-        .atLeastOnce();
-    expect(serverConfig.getEnum("commentlink", "foo", "association", ItsAssociationPolicy.OPTIONAL))
-        .andReturn(ItsAssociationPolicy.MANDATORY)
-        .atLeastOnce();
-    expect(
-            serverConfig.getEnum(
-                "plugin", "ItsTestName", "association", ItsAssociationPolicy.MANDATORY))
-        .andReturn(ItsAssociationPolicy.MANDATORY)
-        .atLeastOnce();
-
-    replayMocks();
+    when(serverConfig.getString("plugin", "ItsTestName", "commentlink")).thenReturn("foo");
+    when(serverConfig.getEnum("commentlink", "foo", "association", ItsAssociationPolicy.OPTIONAL))
+        .thenReturn(ItsAssociationPolicy.MANDATORY);
+    when(serverConfig.getEnum(
+            "plugin", "ItsTestName", "association", ItsAssociationPolicy.MANDATORY))
+        .thenReturn(ItsAssociationPolicy.MANDATORY);
 
     assertEquals(
         "Expected and generated associated policy do not match",
         ItsAssociationPolicy.MANDATORY,
         itsConfig.getItsAssociationPolicy());
+
+    verifyOneOrMore(serverConfig).getString("plugin", "ItsTestName", "commentlink");
+    verifyOneOrMore(serverConfig)
+        .getEnum("commentlink", "foo", "association", ItsAssociationPolicy.OPTIONAL);
+    verifyOneOrMore(serverConfig)
+        .getEnum("plugin", "ItsTestName", "association", ItsAssociationPolicy.MANDATORY);
   }
 
   private ItsConfig createItsConfig() {
     return injector.getInstance(ItsConfig.class);
   }
 
+  private <T> T verifyOneOrMore(T mock) {
+    return verify(mock, atLeastOnce());
+  }
+
   @Override
   public void setUp() throws Exception {
     super.setUp();
@@ -839,15 +726,15 @@
   private class TestModule extends FactoryModule {
     @Override
     protected void configure() {
-      projectCache = createMock(ProjectCache.class);
+      projectCache = mock(ProjectCache.class);
       bind(ProjectCache.class).toInstance(projectCache);
 
-      pluginConfigFactory = createMock(PluginConfigFactory.class);
+      pluginConfigFactory = mock(PluginConfigFactory.class);
       bind(PluginConfigFactory.class).toInstance(pluginConfigFactory);
 
       bind(String.class).annotatedWith(PluginName.class).toInstance("ItsTestName");
 
-      serverConfig = createMock(Config.class);
+      serverConfig = mock(Config.class);
       bind(Config.class).annotatedWith(GerritServerConfig.class).toInstance(serverConfig);
     }
   }
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/testutil/LoggingMockingTestCase.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/testutil/LoggingMockingTestCase.java
index 8256873..03dda08 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/testutil/LoggingMockingTestCase.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/testutil/LoggingMockingTestCase.java
@@ -22,11 +22,12 @@
 import com.googlesource.gerrit.plugins.its.base.testutil.log.LogUtil;
 import java.sql.Timestamp;
 import java.util.Iterator;
+import junit.framework.TestCase;
 import org.apache.log4j.Level;
 import org.apache.log4j.spi.LoggingEvent;
 import org.junit.After;
 
-public abstract class LoggingMockingTestCase extends MockingTestCase {
+public abstract class LoggingMockingTestCase extends TestCase {
 
   protected final Change.Key testChangeKey =
       Change.key("Ic19f7bf6c8b4685c363a8204c32d827ffda52ec0");
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/testutil/MockingTestCase.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/testutil/MockingTestCase.java
deleted file mode 100644
index d717024..0000000
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/testutil/MockingTestCase.java
+++ /dev/null
@@ -1,157 +0,0 @@
-// Copyright (C) 2013 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package com.googlesource.gerrit.plugins.its.base.testutil;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import junit.framework.TestCase;
-import org.easymock.Capture;
-import org.easymock.EasyMock;
-import org.easymock.IMocksControl;
-import org.junit.After;
-import org.junit.runner.RunWith;
-import org.powermock.api.easymock.PowerMock;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-/** Test case with some support for automatically verifying mocks. */
-public abstract class MockingTestCase extends TestCase {
-  private Collection<Object> mocks;
-  private Collection<IMocksControl> mockControls;
-  private boolean mocksReplayed;
-  private boolean usePowerMock;
-
-  /**
-   * Create and register a mock control.
-   *
-   * @return The mock control instance.
-   */
-  protected final IMocksControl createMockControl() {
-    IMocksControl mockControl = EasyMock.createControl();
-    assertTrue("Adding mock control failed", mockControls.add(mockControl));
-    return mockControl;
-  }
-
-  /**
-   * Create and register a mock.
-   *
-   * <p>Creates a mock and registers it in the list of created mocks, so it gets treated
-   * automatically upon {@code replay} and {@code verify};
-   *
-   * @param toMock The class to create a mock for.
-   * @return The mock instance.
-   */
-  protected final <T> T createMock(Class<T> toMock) {
-    return createMock(toMock, null);
-  }
-
-  /**
-   * Create a mock for a mock control and register a mock.
-   *
-   * <p>Creates a mock and registers it in the list of created mocks, so it gets treated
-   * automatically upon {@code replay} and {@code verify};
-   *
-   * @param toMock The class to create a mock for.
-   * @param control The mock control to create the mock on. If null, do not use a specific control.
-   * @return The mock instance.
-   */
-  protected final <T> T createMock(Class<T> toMock, IMocksControl control) {
-    assertFalse("Mocks have already been set to replay", mocksReplayed);
-    final T mock;
-    if (control == null) {
-      if (usePowerMock) {
-        mock = PowerMock.createMock(toMock);
-      } else {
-        mock = EasyMock.createMock(toMock);
-      }
-      assertTrue("Adding " + toMock.getName() + " mock failed", mocks.add(mock));
-    } else {
-      mock = control.createMock(toMock);
-    }
-    return mock;
-  }
-
-  /** Set all registered mocks to replay */
-  protected final void replayMocks() {
-    assertFalse("Mocks have already been set to replay", mocksReplayed);
-    if (usePowerMock) {
-      PowerMock.replayAll();
-    } else {
-      EasyMock.replay(mocks.toArray());
-    }
-    for (IMocksControl mockControl : mockControls) {
-      mockControl.replay();
-    }
-    mocksReplayed = true;
-  }
-
-  /**
-   * Verify all registered mocks
-   *
-   * <p>This method is called automatically at the end of a test. Nevertheless, it is safe to also
-   * call it beforehand, if this better meets the verification part of a test.
-   */
-  // As the PowerMock runner does not pass through runTest, we inject mock
-  // verification through @After
-  @After
-  public final void verifyMocks() {
-    if (!mocks.isEmpty() || !mockControls.isEmpty()) {
-      assertTrue(
-          "Created mocks have not been set to replay. Call replayMocks " + "within the test",
-          mocksReplayed);
-      if (usePowerMock) {
-        PowerMock.verifyAll();
-      } else {
-        EasyMock.verify(mocks.toArray());
-      }
-      for (IMocksControl mockControl : mockControls) {
-        mockControl.verify();
-      }
-    }
-  }
-
-  @Override
-  public void setUp() throws Exception {
-    super.setUp();
-
-    usePowerMock = false;
-    RunWith runWith = this.getClass().getAnnotation(RunWith.class);
-    if (runWith != null) {
-      usePowerMock = PowerMockRunner.class.isAssignableFrom(runWith.value());
-    }
-
-    mocks = new ArrayList<>();
-    mockControls = new ArrayList<>();
-    mocksReplayed = false;
-  }
-
-  @Override
-  protected void runTest() throws Throwable {
-    super.runTest();
-    // Plain JUnit runner does not pick up @After, so we add it here
-    // explicitly. Note, that we cannot put this into tearDown, as failure
-    // to verify mocks would bail out and might leave open resources from
-    // subclasses open.
-    verifyMocks();
-  }
-
-  /**
-   * Create a new Capture.
-   *
-   * @return The created Capture.
-   */
-  protected final <T> Capture<T> createCapture() {
-    return new Capture<>();
-  }
-}
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/util/IssueExtractorTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/util/IssueExtractorTest.java
index ff5d165..a288f03 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/util/IssueExtractorTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/util/IssueExtractorTest.java
@@ -13,7 +13,10 @@
 // limitations under the License.
 package com.googlesource.gerrit.plugins.its.base.util;
 
-import static org.easymock.EasyMock.expect;
+import static org.mockito.Mockito.atLeastOnce;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 import com.google.common.collect.Maps;
 import com.google.common.collect.Sets;
@@ -30,12 +33,7 @@
 import java.util.Map;
 import java.util.Set;
 import java.util.regex.Pattern;
-import org.junit.runner.RunWith;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
 
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({PatchSet.class})
 public class IssueExtractorTest extends LoggingMockingTestCase {
   private Injector injector;
   private ItsConfig itsConfig;
@@ -45,124 +43,127 @@
   public void testIssueIdsNullPattern() {
     IssueExtractor issueExtractor = injector.getInstance(IssueExtractor.class);
 
-    expect(itsConfig.getIssuePattern()).andReturn(null).atLeastOnce();
-
-    replayMocks();
-
     String[] ret = issueExtractor.getIssueIds("Test");
     assertEquals("Number of found ids do not match", 0, ret.length);
+
+    verifyOneOrMore(itsConfig).getIssuePattern();
   }
 
   public void testIssueIdsNoMatch() {
     IssueExtractor issueExtractor = injector.getInstance(IssueExtractor.class);
 
-    expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d+)")).atLeastOnce();
-    expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
-
-    replayMocks();
+    when(itsConfig.getIssuePattern()).thenReturn(Pattern.compile("bug#(\\d+)"));
+    when(itsConfig.getIssuePatternGroupIndex()).thenReturn(1);
 
     String[] ret = issueExtractor.getIssueIds("Test");
     assertEquals("Number of found ids do not match", 0, ret.length);
 
     assertLogMessageContains("Matching");
+
+    verifyOneOrMore(itsConfig).getIssuePattern();
+    verifyOneOrMore(itsConfig).getIssuePatternGroupIndex();
   }
 
   public void testIssueIdsEmptyGroup() {
     IssueExtractor issueExtractor = injector.getInstance(IssueExtractor.class);
 
-    expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(X*)(\\d+)")).atLeastOnce();
-    expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
-
-    replayMocks();
+    when(itsConfig.getIssuePattern()).thenReturn(Pattern.compile("bug#(X*)(\\d+)"));
+    when(itsConfig.getIssuePatternGroupIndex()).thenReturn(1);
 
     String[] ret = issueExtractor.getIssueIds("bug#4711");
     assertEquals("Number of found ids do not match", 0, ret.length);
 
     assertLogMessageContains("Matching");
+
+    verifyOneOrMore(itsConfig).getIssuePattern();
+    verifyOneOrMore(itsConfig).getIssuePatternGroupIndex();
   }
 
   public void testIssueIdsFullMatch() {
     IssueExtractor issueExtractor = injector.getInstance(IssueExtractor.class);
 
-    expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d+)")).atLeastOnce();
-    expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
-
-    replayMocks();
+    when(itsConfig.getIssuePattern()).thenReturn(Pattern.compile("bug#(\\d+)"));
+    when(itsConfig.getIssuePatternGroupIndex()).thenReturn(1);
 
     String[] ret = issueExtractor.getIssueIds("bug#4711");
     assertEquals("Number of found ids do not match", 1, ret.length);
     assertEquals("First found issue id do not match", "4711", ret[0]);
 
     assertLogMessageContains("Matching");
+
+    verifyOneOrMore(itsConfig).getIssuePattern();
+    verifyOneOrMore(itsConfig).getIssuePatternGroupIndex();
   }
 
   public void testIssueIdsMatch() {
     IssueExtractor issueExtractor = injector.getInstance(IssueExtractor.class);
 
-    expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d+)")).atLeastOnce();
-    expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
-
-    replayMocks();
+    when(itsConfig.getIssuePattern()).thenReturn(Pattern.compile("bug#(\\d+)"));
+    when(itsConfig.getIssuePatternGroupIndex()).thenReturn(1);
 
     String[] ret = issueExtractor.getIssueIds("Foo bug#4711 bar");
     assertEquals("Number of found ids do not match", 1, ret.length);
     assertEquals("Found issue id does not match", "4711", ret[0]);
 
     assertLogMessageContains("Matching");
+
+    verifyOneOrMore(itsConfig).getIssuePattern();
+    verifyOneOrMore(itsConfig).getIssuePatternGroupIndex();
   }
 
   public void testIssueIdsGrouplessMatch() {
     IssueExtractor issueExtractor = injector.getInstance(IssueExtractor.class);
 
-    expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#\\d+")).atLeastOnce();
-    expect(itsConfig.getIssuePatternGroupIndex()).andReturn(0).atLeastOnce();
-
-    replayMocks();
+    when(itsConfig.getIssuePattern()).thenReturn(Pattern.compile("bug#\\d+"));
+    when(itsConfig.getIssuePatternGroupIndex()).thenReturn(0);
 
     String[] ret = issueExtractor.getIssueIds("Foo bug#4711 bar");
     assertEquals("Number of found ids do not match", 1, ret.length);
     assertEquals("Found issue id does not match", "bug#4711", ret[0]);
 
     assertLogMessageContains("Matching");
+
+    verifyOneOrMore(itsConfig).getIssuePattern();
+    verifyOneOrMore(itsConfig).getIssuePatternGroupIndex();
   }
 
   public void testIssueIdsMultiGroupMatchGroup1() {
     IssueExtractor issueExtractor = injector.getInstance(IssueExtractor.class);
 
-    expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d)(\\d+)")).atLeastOnce();
-    expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
-
-    replayMocks();
+    when(itsConfig.getIssuePattern()).thenReturn(Pattern.compile("bug#(\\d)(\\d+)"));
+    when(itsConfig.getIssuePatternGroupIndex()).thenReturn(1);
 
     String[] ret = issueExtractor.getIssueIds("Foo bug#4711 bar");
     assertEquals("Number of found ids do not match", 1, ret.length);
     assertEquals("Found issue id does not match", "4", ret[0]);
 
     assertLogMessageContains("Matching");
+
+    verifyOneOrMore(itsConfig).getIssuePattern();
+    verifyOneOrMore(itsConfig).getIssuePatternGroupIndex();
   }
 
   public void testIssueIdsMultiGroupMatchGroup2() {
     IssueExtractor issueExtractor = injector.getInstance(IssueExtractor.class);
 
-    expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d)(\\d+)")).atLeastOnce();
-    expect(itsConfig.getIssuePatternGroupIndex()).andReturn(2).atLeastOnce();
-
-    replayMocks();
+    when(itsConfig.getIssuePattern()).thenReturn(Pattern.compile("bug#(\\d)(\\d+)"));
+    when(itsConfig.getIssuePatternGroupIndex()).thenReturn(2);
 
     String[] ret = issueExtractor.getIssueIds("Foo bug#4711 bar");
     assertEquals("Number of found ids do not match", 1, ret.length);
     assertEquals("Found issue id does not match", "711", ret[0]);
 
     assertLogMessageContains("Matching");
+
+    verifyOneOrMore(itsConfig).getIssuePattern();
+    verifyOneOrMore(itsConfig).getIssuePatternGroupIndex();
   }
 
   public void testIssueIdsMulipleMatches() {
     IssueExtractor issueExtractor = injector.getInstance(IssueExtractor.class);
 
-    expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d+)")).atLeastOnce();
-    expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
-
-    replayMocks();
+    when(itsConfig.getIssuePattern()).thenReturn(Pattern.compile("bug#(\\d+)"));
+    when(itsConfig.getIssuePatternGroupIndex()).thenReturn(1);
 
     String[] ret = issueExtractor.getIssueIds("Foo bug#4711 bug#42 bar bug#123");
     assertEquals("Number of found ids do not match", 3, ret.length);
@@ -172,15 +173,16 @@
     assertTrue("123 not among the extracted ids", retList.contains("123"));
 
     assertLogMessageContains("Matching");
+
+    verifyOneOrMore(itsConfig).getIssuePattern();
+    verifyOneOrMore(itsConfig).getIssuePatternGroupIndex();
   }
 
   public void testIssueIdsMulipleMatchesWithDuplicates() {
     IssueExtractor issueExtractor = injector.getInstance(IssueExtractor.class);
 
-    expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d+)")).atLeastOnce();
-    expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
-
-    replayMocks();
+    when(itsConfig.getIssuePattern()).thenReturn(Pattern.compile("bug#(\\d+)"));
+    when(itsConfig.getIssuePatternGroupIndex()).thenReturn(1);
 
     String[] ret = issueExtractor.getIssueIds("Foo bug#4711 bug#42 bar\n" + "bug#123 baz bug#42");
     assertEquals("Number of found ids do not match", 3, ret.length);
@@ -190,18 +192,18 @@
     assertTrue("123 not among the extracted ids", retList.contains("123"));
 
     assertLogMessageContains("Matching");
+
+    verifyOneOrMore(itsConfig).getIssuePattern();
+    verifyOneOrMore(itsConfig).getIssuePatternGroupIndex();
   }
 
   public void testIssueIdsCommitSingleIssue() {
-    expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d+)")).atLeastOnce();
-    expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
+    when(itsConfig.getIssuePattern()).thenReturn(Pattern.compile("bug#(\\d+)"));
+    when(itsConfig.getIssuePatternGroupIndex()).thenReturn(1);
 
-    expect(
-            commitMessageFetcher.fetchGuarded(
-                "testProject", "1234567891123456789212345678931234567894"))
-        .andReturn("bug#42\n" + "\n" + "Change-Id: I1234567891123456789212345678931234567894");
-
-    replayMocks();
+    when(commitMessageFetcher.fetchGuarded(
+            "testProject", "1234567891123456789212345678931234567894"))
+        .thenReturn("bug#42\n" + "\n" + "Change-Id: I1234567891123456789212345678931234567894");
 
     IssueExtractor issueExtractor = injector.getInstance(IssueExtractor.class);
     Map<String, Set<String>> actual =
@@ -216,22 +218,22 @@
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
+
+    verifyOneOrMore(itsConfig).getIssuePattern();
+    verifyOneOrMore(itsConfig).getIssuePatternGroupIndex();
   }
 
   public void testIssueIdsCommitMultipleIssues() {
-    expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d+)")).atLeastOnce();
-    expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
+    when(itsConfig.getIssuePattern()).thenReturn(Pattern.compile("bug#(\\d+)"));
+    when(itsConfig.getIssuePatternGroupIndex()).thenReturn(1);
 
-    expect(
-            commitMessageFetcher.fetchGuarded(
-                "testProject", "1234567891123456789212345678931234567894"))
-        .andReturn(
+    when(commitMessageFetcher.fetchGuarded(
+            "testProject", "1234567891123456789212345678931234567894"))
+        .thenReturn(
             "bug#42, and bug#4711\n"
                 + "\n"
                 + "Change-Id: I1234567891123456789212345678931234567894");
 
-    replayMocks();
-
     IssueExtractor issueExtractor = injector.getInstance(IssueExtractor.class);
     Map<String, Set<String>> actual =
         issueExtractor.getIssueIds("testProject", "1234567891123456789212345678931234567894");
@@ -246,22 +248,22 @@
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
+
+    verifyOneOrMore(itsConfig).getIssuePattern();
+    verifyOneOrMore(itsConfig).getIssuePatternGroupIndex();
   }
 
   public void testIssueIdsCommitMultipleIssuesMultipleTimes() {
-    expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d+)")).atLeastOnce();
-    expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
+    when(itsConfig.getIssuePattern()).thenReturn(Pattern.compile("bug#(\\d+)"));
+    when(itsConfig.getIssuePatternGroupIndex()).thenReturn(1);
 
-    expect(
-            commitMessageFetcher.fetchGuarded(
-                "testProject", "1234567891123456789212345678931234567894"))
-        .andReturn(
+    when(commitMessageFetcher.fetchGuarded(
+            "testProject", "1234567891123456789212345678931234567894"))
+        .thenReturn(
             "bug#42, bug#4711, bug#4711, bug#42, and bug#4711\n"
                 + "\n"
                 + "Change-Id: I1234567891123456789212345678931234567894");
 
-    replayMocks();
-
     IssueExtractor issueExtractor = injector.getInstance(IssueExtractor.class);
     Map<String, Set<String>> actual =
         issueExtractor.getIssueIds("testProject", "1234567891123456789212345678931234567894");
@@ -276,24 +278,24 @@
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
+
+    verifyOneOrMore(itsConfig).getIssuePattern();
+    verifyOneOrMore(itsConfig).getIssuePatternGroupIndex();
   }
 
   public void testIssueIdsCommitSingleIssueBody() {
-    expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d+)")).atLeastOnce();
-    expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
+    when(itsConfig.getIssuePattern()).thenReturn(Pattern.compile("bug#(\\d+)"));
+    when(itsConfig.getIssuePatternGroupIndex()).thenReturn(1);
 
-    expect(
-            commitMessageFetcher.fetchGuarded(
-                "testProject", "1234567891123456789212345678931234567894"))
-        .andReturn(
+    when(commitMessageFetcher.fetchGuarded(
+            "testProject", "1234567891123456789212345678931234567894"))
+        .thenReturn(
             "Subject does not reference a bug\n"
                 + "Body references bug#42\n"
                 + "\n"
                 + "Footer: does not reference a bug\n"
                 + "Change-Id: I1234567891123456789212345678931234567894");
 
-    replayMocks();
-
     IssueExtractor issueExtractor = injector.getInstance(IssueExtractor.class);
     Map<String, Set<String>> actual =
         issueExtractor.getIssueIds("testProject", "1234567891123456789212345678931234567894");
@@ -308,24 +310,24 @@
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
+
+    verifyOneOrMore(itsConfig).getIssuePattern();
+    verifyOneOrMore(itsConfig).getIssuePatternGroupIndex();
   }
 
   public void testIssueIdsCommitSingleIssueFooter() {
-    expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d+)")).atLeastOnce();
-    expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
+    when(itsConfig.getIssuePattern()).thenReturn(Pattern.compile("bug#(\\d+)"));
+    when(itsConfig.getIssuePatternGroupIndex()).thenReturn(1);
 
-    expect(
-            commitMessageFetcher.fetchGuarded(
-                "testProject", "1234567891123456789212345678931234567894"))
-        .andReturn(
+    when(commitMessageFetcher.fetchGuarded(
+            "testProject", "1234567891123456789212345678931234567894"))
+        .thenReturn(
             "Subject does not reference a bug\n"
                 + "Body does not reference a bug\n"
                 + "\n"
                 + "Footer: references bug#42\n"
                 + "Change-Id: I1234567891123456789212345678931234567894");
 
-    replayMocks();
-
     IssueExtractor issueExtractor = injector.getInstance(IssueExtractor.class);
     Map<String, Set<String>> actual =
         issueExtractor.getIssueIds("testProject", "1234567891123456789212345678931234567894");
@@ -340,16 +342,18 @@
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
+
+    verifyOneOrMore(itsConfig).getIssuePattern();
+    verifyOneOrMore(itsConfig).getIssuePatternGroupIndex();
   }
 
   public void testIssueIdsCommitMultipleIssuesFooter() {
-    expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d+)")).atLeastOnce();
-    expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
+    when(itsConfig.getIssuePattern()).thenReturn(Pattern.compile("bug#(\\d+)"));
+    when(itsConfig.getIssuePatternGroupIndex()).thenReturn(1);
 
-    expect(
-            commitMessageFetcher.fetchGuarded(
-                "testProject", "1234567891123456789212345678931234567894"))
-        .andReturn(
+    when(commitMessageFetcher.fetchGuarded(
+            "testProject", "1234567891123456789212345678931234567894"))
+        .thenReturn(
             "Subject does not reference a bug\n"
                 + "Body does not reference a bug\n"
                 + "\n"
@@ -360,8 +364,6 @@
                 + "Change-Id: I1234567891123456789212345678931234567894\n"
                 + "KeyZ: references bug#256");
 
-    replayMocks();
-
     IssueExtractor issueExtractor = injector.getInstance(IssueExtractor.class);
     Map<String, Set<String>> actual =
         issueExtractor.getIssueIds("testProject", "1234567891123456789212345678931234567894");
@@ -382,16 +384,18 @@
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
+
+    verifyOneOrMore(itsConfig).getIssuePattern();
+    verifyOneOrMore(itsConfig).getIssuePatternGroupIndex();
   }
 
   public void testIssueIdsCommitDifferentParts() {
-    expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d+)")).atLeastOnce();
-    expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
+    when(itsConfig.getIssuePattern()).thenReturn(Pattern.compile("bug#(\\d+)"));
+    when(itsConfig.getIssuePatternGroupIndex()).thenReturn(1);
 
-    expect(
-            commitMessageFetcher.fetchGuarded(
-                "testProject", "1234567891123456789212345678931234567894"))
-        .andReturn(
+    when(commitMessageFetcher.fetchGuarded(
+            "testProject", "1234567891123456789212345678931234567894"))
+        .thenReturn(
             "Subject references bug#42.\n"
                 + "Body references bug#16.\n"
                 + "Body also references bug#176.\n"
@@ -399,8 +403,6 @@
                 + "Bug: bug#4711 in footer\n"
                 + "Change-Id: I1234567891123456789212345678931234567894");
 
-    replayMocks();
-
     IssueExtractor issueExtractor = injector.getInstance(IssueExtractor.class);
     Map<String, Set<String>> actual =
         issueExtractor.getIssueIds("testProject", "1234567891123456789212345678931234567894");
@@ -418,16 +420,18 @@
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
+
+    verifyOneOrMore(itsConfig).getIssuePattern();
+    verifyOneOrMore(itsConfig).getIssuePatternGroupIndex();
   }
 
   public void testIssueIdsCommitDifferentPartsEmptySubject() {
-    expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d+)")).atLeastOnce();
-    expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
+    when(itsConfig.getIssuePattern()).thenReturn(Pattern.compile("bug#(\\d+)"));
+    when(itsConfig.getIssuePatternGroupIndex()).thenReturn(1);
 
-    expect(
-            commitMessageFetcher.fetchGuarded(
-                "testProject", "1234567891123456789212345678931234567894"))
-        .andReturn(
+    when(commitMessageFetcher.fetchGuarded(
+            "testProject", "1234567891123456789212345678931234567894"))
+        .thenReturn(
             "\n"
                 + "Body references bug#16.\n"
                 + "Body also references bug#176.\n"
@@ -435,8 +439,6 @@
                 + "Bug: bug#4711 in footer\n"
                 + "Change-Id: I1234567891123456789212345678931234567894");
 
-    replayMocks();
-
     IssueExtractor issueExtractor = injector.getInstance(IssueExtractor.class);
     Map<String, Set<String>> actual =
         issueExtractor.getIssueIds("testProject", "1234567891123456789212345678931234567894");
@@ -453,16 +455,18 @@
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
+
+    verifyOneOrMore(itsConfig).getIssuePattern();
+    verifyOneOrMore(itsConfig).getIssuePatternGroupIndex();
   }
 
   public void testIssueIdsCommitDifferentPartsLinePastFooter() {
-    expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d+)")).atLeastOnce();
-    expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
+    when(itsConfig.getIssuePattern()).thenReturn(Pattern.compile("bug#(\\d+)"));
+    when(itsConfig.getIssuePatternGroupIndex()).thenReturn(1);
 
-    expect(
-            commitMessageFetcher.fetchGuarded(
-                "testProject", "1234567891123456789212345678931234567894"))
-        .andReturn(
+    when(commitMessageFetcher.fetchGuarded(
+            "testProject", "1234567891123456789212345678931234567894"))
+        .thenReturn(
             "Subject references bug#42.\n"
                 + "Body references bug#16.\n"
                 + "Body also references bug#176.\n"
@@ -470,8 +474,6 @@
                 + "Bug: bug#4711 in footer\n"
                 + "Change-Id: I1234567891123456789212345678931234567894\n");
 
-    replayMocks();
-
     IssueExtractor issueExtractor = injector.getInstance(IssueExtractor.class);
     Map<String, Set<String>> actual =
         issueExtractor.getIssueIds("testProject", "1234567891123456789212345678931234567894");
@@ -489,16 +491,18 @@
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
+
+    verifyOneOrMore(itsConfig).getIssuePattern();
+    verifyOneOrMore(itsConfig).getIssuePatternGroupIndex();
   }
 
   public void testIssueIdsCommitDifferentPartsLinesPastFooter() {
-    expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d+)")).atLeastOnce();
-    expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
+    when(itsConfig.getIssuePattern()).thenReturn(Pattern.compile("bug#(\\d+)"));
+    when(itsConfig.getIssuePatternGroupIndex()).thenReturn(1);
 
-    expect(
-            commitMessageFetcher.fetchGuarded(
-                "testProject", "1234567891123456789212345678931234567894"))
-        .andReturn(
+    when(commitMessageFetcher.fetchGuarded(
+            "testProject", "1234567891123456789212345678931234567894"))
+        .thenReturn(
             "Subject references bug#42.\n"
                 + "Body references bug#16.\n"
                 + "Body also references bug#176.\n"
@@ -507,8 +511,6 @@
                 + "Change-Id: I1234567891123456789212345678931234567894\n"
                 + "\n");
 
-    replayMocks();
-
     IssueExtractor issueExtractor = injector.getInstance(IssueExtractor.class);
     Map<String, Set<String>> actual =
         issueExtractor.getIssueIds("testProject", "1234567891123456789212345678931234567894");
@@ -526,22 +528,22 @@
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
+
+    verifyOneOrMore(itsConfig).getIssuePattern();
+    verifyOneOrMore(itsConfig).getIssuePatternGroupIndex();
   }
 
   public void testIssueIdsCommitDifferentPartsNoFooter() {
-    expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d+)")).atLeastOnce();
-    expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
+    when(itsConfig.getIssuePattern()).thenReturn(Pattern.compile("bug#(\\d+)"));
+    when(itsConfig.getIssuePatternGroupIndex()).thenReturn(1);
 
-    expect(
-            commitMessageFetcher.fetchGuarded(
-                "testProject", "1234567891123456789212345678931234567894"))
-        .andReturn(
+    when(commitMessageFetcher.fetchGuarded(
+            "testProject", "1234567891123456789212345678931234567894"))
+        .thenReturn(
             "Subject references bug#42.\n"
                 + "Body references bug#16.\n"
                 + "Body also references bug#176.");
 
-    replayMocks();
-
     IssueExtractor issueExtractor = injector.getInstance(IssueExtractor.class);
     Map<String, Set<String>> actual =
         issueExtractor.getIssueIds("testProject", "1234567891123456789212345678931234567894");
@@ -555,22 +557,22 @@
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
+
+    verifyOneOrMore(itsConfig).getIssuePattern();
+    verifyOneOrMore(itsConfig).getIssuePatternGroupIndex();
   }
 
   public void testIssueIdsCommitDifferentPartsNoFooterTrailingLine() {
-    expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d+)")).atLeastOnce();
-    expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
+    when(itsConfig.getIssuePattern()).thenReturn(Pattern.compile("bug#(\\d+)"));
+    when(itsConfig.getIssuePatternGroupIndex()).thenReturn(1);
 
-    expect(
-            commitMessageFetcher.fetchGuarded(
-                "testProject", "1234567891123456789212345678931234567894"))
-        .andReturn(
+    when(commitMessageFetcher.fetchGuarded(
+            "testProject", "1234567891123456789212345678931234567894"))
+        .thenReturn(
             "Subject references bug#42.\n"
                 + "Body references bug#16.\n"
                 + "Body also references bug#176.\n");
 
-    replayMocks();
-
     IssueExtractor issueExtractor = injector.getInstance(IssueExtractor.class);
     Map<String, Set<String>> actual =
         issueExtractor.getIssueIds("testProject", "1234567891123456789212345678931234567894");
@@ -584,23 +586,23 @@
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
+
+    verifyOneOrMore(itsConfig).getIssuePattern();
+    verifyOneOrMore(itsConfig).getIssuePatternGroupIndex();
   }
 
   public void testIssueIdsCommitDifferentPartsNoFooterTrailingLines() {
-    expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d+)")).atLeastOnce();
-    expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
+    when(itsConfig.getIssuePattern()).thenReturn(Pattern.compile("bug#(\\d+)"));
+    when(itsConfig.getIssuePatternGroupIndex()).thenReturn(1);
 
-    expect(
-            commitMessageFetcher.fetchGuarded(
-                "testProject", "1234567891123456789212345678931234567894"))
-        .andReturn(
+    when(commitMessageFetcher.fetchGuarded(
+            "testProject", "1234567891123456789212345678931234567894"))
+        .thenReturn(
             "Subject references bug#42.\n"
                 + "Body references bug#16.\n"
                 + "Body also references bug#176.\n"
                 + "\n");
 
-    replayMocks();
-
     IssueExtractor issueExtractor = injector.getInstance(IssueExtractor.class);
     Map<String, Set<String>> actual =
         issueExtractor.getIssueIds("testProject", "1234567891123456789212345678931234567894");
@@ -614,18 +616,18 @@
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
+
+    verifyOneOrMore(itsConfig).getIssuePattern();
+    verifyOneOrMore(itsConfig).getIssuePatternGroupIndex();
   }
 
   public void testIssueIdsCommitEmpty() {
-    expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d+)")).atLeastOnce();
-    expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
+    when(itsConfig.getIssuePattern()).thenReturn(Pattern.compile("bug#(\\d+)"));
+    when(itsConfig.getIssuePatternGroupIndex()).thenReturn(1);
 
-    expect(
-            commitMessageFetcher.fetchGuarded(
-                "testProject", "1234567891123456789212345678931234567894"))
-        .andReturn("");
-
-    replayMocks();
+    when(commitMessageFetcher.fetchGuarded(
+            "testProject", "1234567891123456789212345678931234567894"))
+        .thenReturn("");
 
     IssueExtractor issueExtractor = injector.getInstance(IssueExtractor.class);
     Map<String, Set<String>> actual =
@@ -637,18 +639,18 @@
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
+
+    verifyOneOrMore(itsConfig).getIssuePattern();
+    verifyOneOrMore(itsConfig).getIssuePatternGroupIndex();
   }
 
   public void testIssueIdsCommitBlankLine() {
-    expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d+)")).atLeastOnce();
-    expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
+    when(itsConfig.getIssuePattern()).thenReturn(Pattern.compile("bug#(\\d+)"));
+    when(itsConfig.getIssuePatternGroupIndex()).thenReturn(1);
 
-    expect(
-            commitMessageFetcher.fetchGuarded(
-                "testProject", "1234567891123456789212345678931234567894"))
-        .andReturn("\n");
-
-    replayMocks();
+    when(commitMessageFetcher.fetchGuarded(
+            "testProject", "1234567891123456789212345678931234567894"))
+        .thenReturn("\n");
 
     IssueExtractor issueExtractor = injector.getInstance(IssueExtractor.class);
     Map<String, Set<String>> actual =
@@ -658,18 +660,18 @@
     assertEquals("Extracted issues do not match", expected, actual);
 
     assertLogMessageContains("Matching");
+
+    verifyOneOrMore(itsConfig).getIssuePattern();
+    verifyOneOrMore(itsConfig).getIssuePatternGroupIndex();
   }
 
   public void testIssueIdsCommitBlankLines() {
-    expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d+)")).atLeastOnce();
-    expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
+    when(itsConfig.getIssuePattern()).thenReturn(Pattern.compile("bug#(\\d+)"));
+    when(itsConfig.getIssuePatternGroupIndex()).thenReturn(1);
 
-    expect(
-            commitMessageFetcher.fetchGuarded(
-                "testProject", "1234567891123456789212345678931234567894"))
-        .andReturn("\n\n");
-
-    replayMocks();
+    when(commitMessageFetcher.fetchGuarded(
+            "testProject", "1234567891123456789212345678931234567894"))
+        .thenReturn("\n\n");
 
     IssueExtractor issueExtractor = injector.getInstance(IssueExtractor.class);
     Map<String, Set<String>> actual =
@@ -679,18 +681,18 @@
     assertEquals("Extracted issues do not match", expected, actual);
 
     assertLogMessageContains("Matching");
+
+    verifyOneOrMore(itsConfig).getIssuePattern();
+    verifyOneOrMore(itsConfig).getIssuePatternGroupIndex();
   }
 
   public void testIssueIdsCommitMoreBlankLines() {
-    expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d+)")).atLeastOnce();
-    expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
+    when(itsConfig.getIssuePattern()).thenReturn(Pattern.compile("bug#(\\d+)"));
+    when(itsConfig.getIssuePatternGroupIndex()).thenReturn(1);
 
-    expect(
-            commitMessageFetcher.fetchGuarded(
-                "testProject", "1234567891123456789212345678931234567894"))
-        .andReturn("\n\n\n");
-
-    replayMocks();
+    when(commitMessageFetcher.fetchGuarded(
+            "testProject", "1234567891123456789212345678931234567894"))
+        .thenReturn("\n\n\n");
 
     IssueExtractor issueExtractor = injector.getInstance(IssueExtractor.class);
     Map<String, Set<String>> actual =
@@ -700,16 +702,18 @@
     assertEquals("Extracted issues do not match", expected, actual);
 
     assertLogMessageContains("Matching");
+
+    verifyOneOrMore(itsConfig).getIssuePattern();
+    verifyOneOrMore(itsConfig).getIssuePatternGroupIndex();
   }
 
   public void testIssueIdsCommitMixed() {
-    expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d+)")).atLeastOnce();
-    expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
+    when(itsConfig.getIssuePattern()).thenReturn(Pattern.compile("bug#(\\d+)"));
+    when(itsConfig.getIssuePatternGroupIndex()).thenReturn(1);
 
-    expect(
-            commitMessageFetcher.fetchGuarded(
-                "testProject", "1234567891123456789212345678931234567894"))
-        .andReturn(
+    when(commitMessageFetcher.fetchGuarded(
+            "testProject", "1234567891123456789212345678931234567894"))
+        .thenReturn(
             "Subject bug#42, bug#1984, and bug#16\n"
                 + "\n"
                 + "bug#4711 in body,\n"
@@ -719,8 +723,6 @@
                 + "Bug: bug#176, bug#1984, and bug#5150\n"
                 + "Change-Id: I1234567891123456789212345678931234567894");
 
-    replayMocks();
-
     IssueExtractor issueExtractor = injector.getInstance(IssueExtractor.class);
     Map<String, Set<String>> actual =
         issueExtractor.getIssueIds("testProject", "1234567891123456789212345678931234567894");
@@ -740,18 +742,18 @@
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
+
+    verifyOneOrMore(itsConfig).getIssuePattern();
+    verifyOneOrMore(itsConfig).getIssuePatternGroupIndex();
   }
 
   public void testIssueIdsCommitWAddedEmptyFirst() {
-    expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d+)")).atLeastOnce();
-    expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
+    when(itsConfig.getIssuePattern()).thenReturn(Pattern.compile("bug#(\\d+)"));
+    when(itsConfig.getIssuePatternGroupIndex()).thenReturn(1);
 
-    expect(
-            commitMessageFetcher.fetchGuarded(
-                "testProject", "1234567891123456789212345678931234567894"))
-        .andReturn("");
-
-    replayMocks();
+    when(commitMessageFetcher.fetchGuarded(
+            "testProject", "1234567891123456789212345678931234567894"))
+        .thenReturn("");
 
     PatchSet.Id patchSetId = PatchSet.id(Change.id(4), 1);
     IssueExtractor issueExtractor = injector.getInstance(IssueExtractor.class);
@@ -765,24 +767,24 @@
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
+
+    verifyOneOrMore(itsConfig).getIssuePattern();
+    verifyOneOrMore(itsConfig).getIssuePatternGroupIndex();
   }
 
   public void testIssueIdsCommitWAddedSingleSubjectIssueFirst() {
-    expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d+)")).atLeastOnce();
-    expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
+    when(itsConfig.getIssuePattern()).thenReturn(Pattern.compile("bug#(\\d+)"));
+    when(itsConfig.getIssuePatternGroupIndex()).thenReturn(1);
 
-    Change.Id changeId = createMock(Change.Id.class);
+    Change.Id changeId = mock(Change.Id.class);
 
-    expect(
-            commitMessageFetcher.fetchGuarded(
-                "testProject", "1234567891123456789212345678931234567894"))
-        .andReturn("bug#42\n" + "\n" + "Change-Id: I1234567891123456789212345678931234567894");
+    when(commitMessageFetcher.fetchGuarded(
+            "testProject", "1234567891123456789212345678931234567894"))
+        .thenReturn("bug#42\n" + "\n" + "Change-Id: I1234567891123456789212345678931234567894");
 
-    PatchSet.Id currentPatchSetId = createMock(PatchSet.Id.class);
-    expect(currentPatchSetId.get()).andReturn(1).anyTimes();
-    expect(currentPatchSetId.changeId()).andReturn(changeId).anyTimes();
-
-    replayMocks();
+    PatchSet.Id currentPatchSetId = mock(PatchSet.Id.class);
+    when(currentPatchSetId.get()).thenReturn(1);
+    when(currentPatchSetId.changeId()).thenReturn(changeId);
 
     IssueExtractor issueExtractor = injector.getInstance(IssueExtractor.class);
     Map<String, Set<String>> actual =
@@ -798,35 +800,33 @@
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
+
+    verifyOneOrMore(itsConfig).getIssuePattern();
+    verifyOneOrMore(itsConfig).getIssuePatternGroupIndex();
   }
 
   public void testIssueIdsCommitWAddedSingleSubjectIssueSecondEmpty() {
-    expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d+)")).atLeastOnce();
-    expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
+    when(itsConfig.getIssuePattern()).thenReturn(Pattern.compile("bug#(\\d+)"));
+    when(itsConfig.getIssuePatternGroupIndex()).thenReturn(1);
 
-    Change.Id changeId = createMock(Change.Id.class);
+    Change.Id changeId = mock(Change.Id.class);
 
     // Call for current patch set
-    expect(
-            commitMessageFetcher.fetchGuarded(
-                "testProject", "1234567891123456789212345678931234567894"))
-        .andReturn("bug#42\n" + "\n" + "Change-Id: I1234567891123456789212345678931234567894");
+    when(commitMessageFetcher.fetchGuarded(
+            "testProject", "1234567891123456789212345678931234567894"))
+        .thenReturn("bug#42\n" + "\n" + "Change-Id: I1234567891123456789212345678931234567894");
 
     // Call for previous patch set
     PatchSet.Id previousPatchSetId = PatchSet.id(changeId, 1);
-    expect(db.getRevision(previousPatchSetId))
-        .andReturn("9876543211987654321298765432139876543214");
+    when(db.getRevision(previousPatchSetId)).thenReturn("9876543211987654321298765432139876543214");
 
-    expect(
-            commitMessageFetcher.fetchGuarded(
-                "testProject", "9876543211987654321298765432139876543214"))
-        .andReturn("subject\n" + "\n" + "Change-Id: I9876543211987654321298765432139876543214");
+    when(commitMessageFetcher.fetchGuarded(
+            "testProject", "9876543211987654321298765432139876543214"))
+        .thenReturn("subject\n" + "\n" + "Change-Id: I9876543211987654321298765432139876543214");
 
-    PatchSet.Id currentPatchSetId = createMock(PatchSet.Id.class);
-    expect(currentPatchSetId.get()).andReturn(2).anyTimes();
-    expect(currentPatchSetId.changeId()).andReturn(changeId).anyTimes();
-
-    replayMocks();
+    PatchSet.Id currentPatchSetId = mock(PatchSet.Id.class);
+    when(currentPatchSetId.get()).thenReturn(2);
+    when(currentPatchSetId.changeId()).thenReturn(changeId);
 
     IssueExtractor issueExtractor = injector.getInstance(IssueExtractor.class);
     Map<String, Set<String>> actual =
@@ -847,35 +847,33 @@
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
+
+    verifyOneOrMore(itsConfig).getIssuePattern();
+    verifyOneOrMore(itsConfig).getIssuePatternGroupIndex();
   }
 
   public void testIssueIdsCommitWAddedSingleSubjectIssueSecondSame() {
-    expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d+)")).atLeastOnce();
-    expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
+    when(itsConfig.getIssuePattern()).thenReturn(Pattern.compile("bug#(\\d+)"));
+    when(itsConfig.getIssuePatternGroupIndex()).thenReturn(1);
 
-    Change.Id changeId = createMock(Change.Id.class);
+    Change.Id changeId = mock(Change.Id.class);
 
     // Call for current patch set
-    expect(
-            commitMessageFetcher.fetchGuarded(
-                "testProject", "1234567891123456789212345678931234567894"))
-        .andReturn("bug#42\n" + "\n" + "Change-Id: I1234567891123456789212345678931234567894");
+    when(commitMessageFetcher.fetchGuarded(
+            "testProject", "1234567891123456789212345678931234567894"))
+        .thenReturn("bug#42\n" + "\n" + "Change-Id: I1234567891123456789212345678931234567894");
 
     // Call for previous patch set
     PatchSet.Id previousPatchSetId = PatchSet.id(changeId, 1);
-    expect(
-            commitMessageFetcher.fetchGuarded(
-                "testProject", "9876543211987654321298765432139876543214"))
-        .andReturn("bug#42\n" + "\n" + "Change-Id: I9876543211987654321298765432139876543214");
+    when(commitMessageFetcher.fetchGuarded(
+            "testProject", "9876543211987654321298765432139876543214"))
+        .thenReturn("bug#42\n" + "\n" + "Change-Id: I9876543211987654321298765432139876543214");
 
-    expect(db.getRevision(previousPatchSetId))
-        .andReturn("9876543211987654321298765432139876543214");
+    when(db.getRevision(previousPatchSetId)).thenReturn("9876543211987654321298765432139876543214");
 
-    PatchSet.Id currentPatchSetId = createMock(PatchSet.Id.class);
-    expect(currentPatchSetId.get()).andReturn(2).anyTimes();
-    expect(currentPatchSetId.changeId()).andReturn(changeId).anyTimes();
-
-    replayMocks();
+    PatchSet.Id currentPatchSetId = mock(PatchSet.Id.class);
+    when(currentPatchSetId.get()).thenReturn(2);
+    when(currentPatchSetId.changeId()).thenReturn(changeId);
 
     IssueExtractor issueExtractor = injector.getInstance(IssueExtractor.class);
     Map<String, Set<String>> actual =
@@ -896,39 +894,37 @@
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
+
+    verifyOneOrMore(itsConfig).getIssuePattern();
+    verifyOneOrMore(itsConfig).getIssuePatternGroupIndex();
   }
 
   public void testIssueIdsCommitWAddedSingleSubjectIssueSecondBody() {
-    expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d+)")).atLeastOnce();
-    expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
+    when(itsConfig.getIssuePattern()).thenReturn(Pattern.compile("bug#(\\d+)"));
+    when(itsConfig.getIssuePatternGroupIndex()).thenReturn(1);
 
-    Change.Id changeId = createMock(Change.Id.class);
+    Change.Id changeId = mock(Change.Id.class);
 
     // Call for current patch set
-    expect(
-            commitMessageFetcher.fetchGuarded(
-                "testProject", "1234567891123456789212345678931234567894"))
-        .andReturn("bug#42\n" + "\n" + "Change-Id: I1234567891123456789212345678931234567894");
+    when(commitMessageFetcher.fetchGuarded(
+            "testProject", "1234567891123456789212345678931234567894"))
+        .thenReturn("bug#42\n" + "\n" + "Change-Id: I1234567891123456789212345678931234567894");
 
     // Call for previous patch set
     PatchSet.Id previousPatchSetId = PatchSet.id(changeId, 1);
-    expect(
-            commitMessageFetcher.fetchGuarded(
-                "testProject", "9876543211987654321298765432139876543214"))
-        .andReturn(
+    when(commitMessageFetcher.fetchGuarded(
+            "testProject", "9876543211987654321298765432139876543214"))
+        .thenReturn(
             "subject\n"
                 + "bug#42\n"
                 + "\n"
                 + "Change-Id: I9876543211987654321298765432139876543214");
 
-    expect(db.getRevision(previousPatchSetId))
-        .andReturn("9876543211987654321298765432139876543214");
+    when(db.getRevision(previousPatchSetId)).thenReturn("9876543211987654321298765432139876543214");
 
-    PatchSet.Id currentPatchSetId = createMock(PatchSet.Id.class);
-    expect(currentPatchSetId.get()).andReturn(2).anyTimes();
-    expect(currentPatchSetId.changeId()).andReturn(changeId).anyTimes();
-
-    replayMocks();
+    PatchSet.Id currentPatchSetId = mock(PatchSet.Id.class);
+    when(currentPatchSetId.get()).thenReturn(2);
+    when(currentPatchSetId.changeId()).thenReturn(changeId);
 
     IssueExtractor issueExtractor = injector.getInstance(IssueExtractor.class);
     Map<String, Set<String>> actual =
@@ -949,19 +945,21 @@
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
+
+    verifyOneOrMore(itsConfig).getIssuePattern();
+    verifyOneOrMore(itsConfig).getIssuePatternGroupIndex();
   }
 
   public void testIssueIdsCommitWAddedSingleSubjectIssueSecondFooter() {
-    expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d+)")).atLeastOnce();
-    expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
+    when(itsConfig.getIssuePattern()).thenReturn(Pattern.compile("bug#(\\d+)"));
+    when(itsConfig.getIssuePatternGroupIndex()).thenReturn(1);
 
-    Change.Id changeId = createMock(Change.Id.class);
+    Change.Id changeId = mock(Change.Id.class);
 
     // Call for current patch set
-    expect(
-            commitMessageFetcher.fetchGuarded(
-                "testProject", "1234567891123456789212345678931234567894"))
-        .andReturn(
+    when(commitMessageFetcher.fetchGuarded(
+            "testProject", "1234567891123456789212345678931234567894"))
+        .thenReturn(
             "subject\n"
                 + "\n"
                 + "Bug: bug#42\n"
@@ -969,19 +967,15 @@
 
     // Call for previous patch set
     PatchSet.Id previousPatchSetId = PatchSet.id(changeId, 1);
-    expect(
-            commitMessageFetcher.fetchGuarded(
-                "testProject", "9876543211987654321298765432139876543214"))
-        .andReturn("bug#42\n" + "\n" + "Change-Id: I9876543211987654321298765432139876543214");
+    when(commitMessageFetcher.fetchGuarded(
+            "testProject", "9876543211987654321298765432139876543214"))
+        .thenReturn("bug#42\n" + "\n" + "Change-Id: I9876543211987654321298765432139876543214");
 
-    expect(db.getRevision(previousPatchSetId))
-        .andReturn("9876543211987654321298765432139876543214");
+    when(db.getRevision(previousPatchSetId)).thenReturn("9876543211987654321298765432139876543214");
 
-    PatchSet.Id currentPatchSetId = createMock(PatchSet.Id.class);
-    expect(currentPatchSetId.get()).andReturn(2).anyTimes();
-    expect(currentPatchSetId.changeId()).andReturn(changeId).anyTimes();
-
-    replayMocks();
+    PatchSet.Id currentPatchSetId = mock(PatchSet.Id.class);
+    when(currentPatchSetId.get()).thenReturn(2);
+    when(currentPatchSetId.changeId()).thenReturn(changeId);
 
     IssueExtractor issueExtractor = injector.getInstance(IssueExtractor.class);
     Map<String, Set<String>> actual =
@@ -1005,19 +999,21 @@
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
+
+    verifyOneOrMore(itsConfig).getIssuePattern();
+    verifyOneOrMore(itsConfig).getIssuePatternGroupIndex();
   }
 
   public void testIssueIdsCommitWAddedSubjectFooter() {
-    expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d+)")).atLeastOnce();
-    expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
+    when(itsConfig.getIssuePattern()).thenReturn(Pattern.compile("bug#(\\d+)"));
+    when(itsConfig.getIssuePatternGroupIndex()).thenReturn(1);
 
-    Change.Id changeId = createMock(Change.Id.class);
+    Change.Id changeId = mock(Change.Id.class);
 
     // Call for current patch set
-    expect(
-            commitMessageFetcher.fetchGuarded(
-                "testProject", "1234567891123456789212345678931234567894"))
-        .andReturn(
+    when(commitMessageFetcher.fetchGuarded(
+            "testProject", "1234567891123456789212345678931234567894"))
+        .thenReturn(
             "subject bug#42\n"
                 + "\n"
                 + "body bug#42\n"
@@ -1027,23 +1023,19 @@
 
     // Call for previous patch set
     PatchSet.Id previousPatchSetId = PatchSet.id(changeId, 1);
-    expect(
-            commitMessageFetcher.fetchGuarded(
-                "testProject", "9876543211987654321298765432139876543214"))
-        .andReturn(
+    when(commitMessageFetcher.fetchGuarded(
+            "testProject", "9876543211987654321298765432139876543214"))
+        .thenReturn(
             "subject\n"
                 + "bug#42\n"
                 + "\n"
                 + "Change-Id: I9876543211987654321298765432139876543214");
 
-    expect(db.getRevision(previousPatchSetId))
-        .andReturn("9876543211987654321298765432139876543214");
+    when(db.getRevision(previousPatchSetId)).thenReturn("9876543211987654321298765432139876543214");
 
-    PatchSet.Id currentPatchSetId = createMock(PatchSet.Id.class);
-    expect(currentPatchSetId.get()).andReturn(2).anyTimes();
-    expect(currentPatchSetId.changeId()).andReturn(changeId).anyTimes();
-
-    replayMocks();
+    PatchSet.Id currentPatchSetId = mock(PatchSet.Id.class);
+    when(currentPatchSetId.get()).thenReturn(2);
+    when(currentPatchSetId.changeId()).thenReturn(changeId);
 
     IssueExtractor issueExtractor = injector.getInstance(IssueExtractor.class);
     Map<String, Set<String>> actual =
@@ -1075,19 +1067,21 @@
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
+
+    verifyOneOrMore(itsConfig).getIssuePattern();
+    verifyOneOrMore(itsConfig).getIssuePatternGroupIndex();
   }
 
   public void testIssueIdsCommitWAddedMultiple() {
-    expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d+)")).atLeastOnce();
-    expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
+    when(itsConfig.getIssuePattern()).thenReturn(Pattern.compile("bug#(\\d+)"));
+    when(itsConfig.getIssuePatternGroupIndex()).thenReturn(1);
 
-    Change.Id changeId = createMock(Change.Id.class);
+    Change.Id changeId = mock(Change.Id.class);
 
     // Call for current patch set
-    expect(
-            commitMessageFetcher.fetchGuarded(
-                "testProject", "1234567891123456789212345678931234567894"))
-        .andReturn(
+    when(commitMessageFetcher.fetchGuarded(
+            "testProject", "1234567891123456789212345678931234567894"))
+        .thenReturn(
             "subject bug#42\n"
                 + "\n"
                 + "body bug#42 bug#16\n"
@@ -1097,24 +1091,20 @@
 
     // Call for previous patch set
     PatchSet.Id previousPatchSetId = PatchSet.id(changeId, 1);
-    expect(
-            commitMessageFetcher.fetchGuarded(
-                "testProject", "9876543211987654321298765432139876543214"))
-        .andReturn(
+    when(commitMessageFetcher.fetchGuarded(
+            "testProject", "9876543211987654321298765432139876543214"))
+        .thenReturn(
             "subject\n"
                 + "bug#42 bug#4711\n"
                 + "\n"
                 + "Bug: bug#16\n"
                 + "Change-Id: I9876543211987654321298765432139876543214");
 
-    expect(db.getRevision(previousPatchSetId))
-        .andReturn("9876543211987654321298765432139876543214");
+    when(db.getRevision(previousPatchSetId)).thenReturn("9876543211987654321298765432139876543214");
 
-    PatchSet.Id currentPatchSetId = createMock(PatchSet.Id.class);
-    expect(currentPatchSetId.get()).andReturn(2).anyTimes();
-    expect(currentPatchSetId.changeId()).andReturn(changeId).anyTimes();
-
-    replayMocks();
+    PatchSet.Id currentPatchSetId = mock(PatchSet.Id.class);
+    when(currentPatchSetId.get()).thenReturn(2);
+    when(currentPatchSetId.changeId()).thenReturn(changeId);
 
     IssueExtractor issueExtractor = injector.getInstance(IssueExtractor.class);
     Map<String, Set<String>> actual =
@@ -1148,6 +1138,13 @@
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
     assertLogMessageContains("Matching");
+
+    verifyOneOrMore(itsConfig).getIssuePattern();
+    verifyOneOrMore(itsConfig).getIssuePatternGroupIndex();
+  }
+
+  private <T> T verifyOneOrMore(T mock) {
+    return verify(mock, atLeastOnce());
   }
 
   @Override
@@ -1160,13 +1157,13 @@
   private class TestModule extends FactoryModule {
     @Override
     protected void configure() {
-      itsConfig = createMock(ItsConfig.class);
+      itsConfig = mock(ItsConfig.class);
       bind(ItsConfig.class).toInstance(itsConfig);
 
-      commitMessageFetcher = createMock(CommitMessageFetcher.class);
+      commitMessageFetcher = mock(CommitMessageFetcher.class);
       bind(CommitMessageFetcher.class).toInstance(commitMessageFetcher);
 
-      db = createMock(PatchSetDb.class);
+      db = mock(PatchSetDb.class);
       bind(PatchSetDb.class).toInstance(db);
     }
   }
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/util/ItsProjectExtractorTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/util/ItsProjectExtractorTest.java
index 48bac21..2fbca57 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/util/ItsProjectExtractorTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/util/ItsProjectExtractorTest.java
@@ -14,17 +14,18 @@
 
 package com.googlesource.gerrit.plugins.its.base.util;
 
-import static org.easymock.EasyMock.expect;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 import com.google.gerrit.entities.Project;
 import com.google.gerrit.extensions.config.FactoryModule;
 import com.google.inject.Guice;
 import com.google.inject.Injector;
 import com.googlesource.gerrit.plugins.its.base.its.ItsConfig;
-import com.googlesource.gerrit.plugins.its.base.testutil.MockingTestCase;
 import java.util.Optional;
+import junit.framework.TestCase;
 
-public class ItsProjectExtractorTest extends MockingTestCase {
+public class ItsProjectExtractorTest extends TestCase {
 
   private static final String PROJECT = "project";
   private static final String ITS_PROJECT = "itsProject";
@@ -35,11 +36,9 @@
   public void test() {
     ItsProjectExtractor projectExtractor = injector.getInstance(ItsProjectExtractor.class);
 
-    expect(itsConfig.getItsProjectName(Project.nameKey(PROJECT)))
-        .andReturn(Optional.of(ITS_PROJECT))
-        .once();
-
-    replayMocks();
+    when(itsConfig.getItsProjectName(Project.nameKey(PROJECT)))
+        .thenReturn(Optional.of(ITS_PROJECT))
+        .thenThrow(new UnsupportedOperationException("Method more than once"));
 
     String ret = projectExtractor.getItsProject(PROJECT).orElse(null);
     assertEquals(ret, ITS_PROJECT);
@@ -55,7 +54,7 @@
   private class TestModule extends FactoryModule {
     @Override
     protected void configure() {
-      itsConfig = createMock(ItsConfig.class);
+      itsConfig = mock(ItsConfig.class);
       bind(ItsConfig.class).toInstance(itsConfig);
     }
   }
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractorTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractorTest.java
index 1180118..153f1c3 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractorTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractorTest.java
@@ -13,7 +13,8 @@
 // limitations under the License.
 package com.googlesource.gerrit.plugins.its.base.util;
 
-import static org.easymock.EasyMock.expect;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.Lists;
@@ -38,8 +39,6 @@
   private ItsFacade facade;
 
   public void testAccountAttributeNull() {
-    replayMocks();
-
     PropertyAttributeExtractor extractor = injector.getInstance(PropertyAttributeExtractor.class);
 
     Map<String, String> actual = extractor.extractFrom(null, "prefix");
@@ -55,8 +54,6 @@
     accountAttribute.name = "testName";
     accountAttribute.username = "testUsername";
 
-    replayMocks();
-
     PropertyAttributeExtractor extractor = injector.getInstance(PropertyAttributeExtractor.class);
 
     Map<String, String> actual = extractor.extractFrom(accountAttribute, "prefix");
@@ -87,10 +84,8 @@
     changeAttribute.commitMessage = "Commit Message";
     changeAttribute.status = Change.Status.NEW;
 
-    expect(facade.createLinkForWebui("http://www.example.org/test", "http://www.example.org/test"))
-        .andReturn("http://www.example.org/test");
-
-    replayMocks();
+    when(facade.createLinkForWebui("http://www.example.org/test", "http://www.example.org/test"))
+        .thenReturn("http://www.example.org/test");
 
     PropertyAttributeExtractor extractor = injector.getInstance(PropertyAttributeExtractor.class);
 
@@ -133,10 +128,8 @@
     changeAttribute.commitMessage = "Commit Message";
     changeAttribute.status = Change.Status.NEW;
 
-    expect(facade.createLinkForWebui("http://www.example.org/test", "http://www.example.org/test"))
-        .andReturn("http://www.example.org/test");
-
-    replayMocks();
+    when(facade.createLinkForWebui("http://www.example.org/test", "http://www.example.org/test"))
+        .thenReturn("http://www.example.org/test");
 
     PropertyAttributeExtractor extractor = injector.getInstance(PropertyAttributeExtractor.class);
 
@@ -179,10 +172,8 @@
     changeAttribute.owner = owner;
     changeAttribute.commitMessage = "Commit Message";
 
-    expect(facade.createLinkForWebui("http://www.example.org/test", "http://www.example.org/test"))
-        .andReturn("http://www.example.org/test");
-
-    replayMocks();
+    when(facade.createLinkForWebui("http://www.example.org/test", "http://www.example.org/test"))
+        .thenReturn("http://www.example.org/test");
 
     PropertyAttributeExtractor extractor = injector.getInstance(PropertyAttributeExtractor.class);
 
@@ -231,8 +222,6 @@
     patchSetAttribute.uploader = uploader;
     patchSetAttribute.author = author;
 
-    replayMocks();
-
     PropertyAttributeExtractor extractor = injector.getInstance(PropertyAttributeExtractor.class);
 
     Map<String, String> actual = extractor.extractFrom(patchSetAttribute);
@@ -262,8 +251,6 @@
     refUpdateAttribute.oldRev = "9876543211987654321298765432139876543214";
     refUpdateAttribute.refName = "refs/heads/master";
 
-    replayMocks();
-
     PropertyAttributeExtractor extractor = injector.getInstance(PropertyAttributeExtractor.class);
 
     Map<String, String> actual = extractor.extractFrom(refUpdateAttribute);
@@ -284,8 +271,6 @@
     approvalAttribute.type = "TestType";
     approvalAttribute.value = "TestValue";
 
-    replayMocks();
-
     PropertyAttributeExtractor extractor = injector.getInstance(PropertyAttributeExtractor.class);
 
     Map<String, String> actual = extractor.extractFrom(approvalAttribute);
@@ -299,8 +284,6 @@
     approvalAttribute.type = "Test-Type";
     approvalAttribute.value = "TestValue";
 
-    replayMocks();
-
     PropertyAttributeExtractor extractor = injector.getInstance(PropertyAttributeExtractor.class);
 
     Map<String, String> actual = extractor.extractFrom(approvalAttribute);
@@ -318,7 +301,7 @@
   private class TestModule extends FactoryModule {
     @Override
     protected void configure() {
-      facade = createMock(ItsFacade.class);
+      facade = mock(ItsFacade.class);
       bind(ItsFacade.class).toInstance(facade);
     }
   }
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyExtractorTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyExtractorTest.java
index 09e7fc4..ac7ea92 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyExtractorTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyExtractorTest.java
@@ -13,7 +13,8 @@
 // limitations under the License.
 package com.googlesource.gerrit.plugins.its.base.util;
 
-import static org.easymock.EasyMock.expect;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 import com.google.common.base.Suppliers;
 import com.google.common.collect.ImmutableMap;
@@ -56,9 +57,7 @@
   public void testDummyChangeEvent() {
     PropertyExtractor propertyExtractor = injector.getInstance(PropertyExtractor.class);
 
-    expect(itsProjectExtractor.getItsProject("testProject")).andReturn(Optional.empty());
-
-    replayMocks();
+    when(itsProjectExtractor.getItsProject("testProject")).thenReturn(Optional.empty());
 
     Set<Map<String, String>> actual =
         propertyExtractor.extractFrom(new DummyEvent()).getIssuesProperties();
@@ -70,25 +69,25 @@
   public void testChangeAbandonedEvent() {
     ChangeAbandonedEvent event = new ChangeAbandonedEvent(testChange("testProject", "testBranch"));
 
-    expect(itsProjectExtractor.getItsProject("testProject")).andReturn(Optional.empty());
+    when(itsProjectExtractor.getItsProject("testProject")).thenReturn(Optional.empty());
 
-    ChangeAttribute changeAttribute = createMock(ChangeAttribute.class);
+    ChangeAttribute changeAttribute = mock(ChangeAttribute.class);
     event.change = Suppliers.ofInstance(changeAttribute);
     Map<String, String> changeProperties =
         ImmutableMap.of("project", "testProject", "changeNumber", "176");
-    expect(propertyAttributeExtractor.extractFrom(changeAttribute)).andReturn(changeProperties);
+    when(propertyAttributeExtractor.extractFrom(changeAttribute)).thenReturn(changeProperties);
 
-    AccountAttribute accountAttribute = createMock(AccountAttribute.class);
+    AccountAttribute accountAttribute = mock(AccountAttribute.class);
     event.abandoner = Suppliers.ofInstance(accountAttribute);
     Map<String, String> accountProperties = ImmutableMap.of("abandonerName", "testName");
-    expect(propertyAttributeExtractor.extractFrom(accountAttribute, "abandoner"))
-        .andReturn(accountProperties);
+    when(propertyAttributeExtractor.extractFrom(accountAttribute, "abandoner"))
+        .thenReturn(accountProperties);
 
-    PatchSetAttribute patchSetAttribute = createMock(PatchSetAttribute.class);
+    PatchSetAttribute patchSetAttribute = mock(PatchSetAttribute.class);
     event.patchSet = Suppliers.ofInstance(patchSetAttribute);
     Map<String, String> patchSetProperties =
         ImmutableMap.of("revision", "testRevision", "patchSetNumber", "3");
-    expect(propertyAttributeExtractor.extractFrom(patchSetAttribute)).andReturn(patchSetProperties);
+    when(propertyAttributeExtractor.extractFrom(patchSetAttribute)).thenReturn(patchSetProperties);
 
     event.reason = "testReason";
     changeAttribute.project = "testProject";
@@ -111,25 +110,25 @@
   public void testChangeMergedEvent() {
     ChangeMergedEvent event = new ChangeMergedEvent(testChange("testProject", "testBranch"));
 
-    expect(itsProjectExtractor.getItsProject("testProject")).andReturn(Optional.empty());
+    when(itsProjectExtractor.getItsProject("testProject")).thenReturn(Optional.empty());
 
-    ChangeAttribute changeAttribute = createMock(ChangeAttribute.class);
+    ChangeAttribute changeAttribute = mock(ChangeAttribute.class);
     event.change = Suppliers.ofInstance(changeAttribute);
     Map<String, String> changeProperties =
         ImmutableMap.of("project", "testProject", "changeNumber", "176");
-    expect(propertyAttributeExtractor.extractFrom(changeAttribute)).andReturn(changeProperties);
+    when(propertyAttributeExtractor.extractFrom(changeAttribute)).thenReturn(changeProperties);
 
-    AccountAttribute accountAttribute = createMock(AccountAttribute.class);
+    AccountAttribute accountAttribute = mock(AccountAttribute.class);
     event.submitter = Suppliers.ofInstance(accountAttribute);
     Map<String, String> accountProperties = ImmutableMap.of("submitterName", "testName");
-    expect(propertyAttributeExtractor.extractFrom(accountAttribute, "submitter"))
-        .andReturn(accountProperties);
+    when(propertyAttributeExtractor.extractFrom(accountAttribute, "submitter"))
+        .thenReturn(accountProperties);
 
-    PatchSetAttribute patchSetAttribute = createMock(PatchSetAttribute.class);
+    PatchSetAttribute patchSetAttribute = mock(PatchSetAttribute.class);
     event.patchSet = Suppliers.ofInstance(patchSetAttribute);
     Map<String, String> patchSetProperties =
         ImmutableMap.of("revision", "testRevision", "patchSetNumber", "3");
-    expect(propertyAttributeExtractor.extractFrom(patchSetAttribute)).andReturn(patchSetProperties);
+    when(propertyAttributeExtractor.extractFrom(patchSetAttribute)).thenReturn(patchSetProperties);
 
     changeAttribute.project = "testProject";
     changeAttribute.number = 176;
@@ -150,25 +149,25 @@
   public void testChangeRestoredEvent() {
     ChangeRestoredEvent event = new ChangeRestoredEvent(testChange("testProject", "testBranch"));
 
-    expect(itsProjectExtractor.getItsProject("testProject")).andReturn(Optional.empty());
+    when(itsProjectExtractor.getItsProject("testProject")).thenReturn(Optional.empty());
 
-    ChangeAttribute changeAttribute = createMock(ChangeAttribute.class);
+    ChangeAttribute changeAttribute = mock(ChangeAttribute.class);
     event.change = Suppliers.ofInstance(changeAttribute);
     Map<String, String> changeProperties =
         ImmutableMap.of("project", "testProject", "changeNumber", "176");
-    expect(propertyAttributeExtractor.extractFrom(changeAttribute)).andReturn(changeProperties);
+    when(propertyAttributeExtractor.extractFrom(changeAttribute)).thenReturn(changeProperties);
 
-    AccountAttribute accountAttribute = createMock(AccountAttribute.class);
+    AccountAttribute accountAttribute = mock(AccountAttribute.class);
     event.restorer = Suppliers.ofInstance(accountAttribute);
     Map<String, String> accountProperties = ImmutableMap.of("restorerName", "testName");
-    expect(propertyAttributeExtractor.extractFrom(accountAttribute, "restorer"))
-        .andReturn(accountProperties);
+    when(propertyAttributeExtractor.extractFrom(accountAttribute, "restorer"))
+        .thenReturn(accountProperties);
 
-    PatchSetAttribute patchSetAttribute = createMock(PatchSetAttribute.class);
+    PatchSetAttribute patchSetAttribute = mock(PatchSetAttribute.class);
     event.patchSet = Suppliers.ofInstance(patchSetAttribute);
     Map<String, String> patchSetProperties =
         ImmutableMap.of("revision", "testRevision", "patchSetNumber", "3");
-    expect(propertyAttributeExtractor.extractFrom(patchSetAttribute)).andReturn(patchSetProperties);
+    when(propertyAttributeExtractor.extractFrom(patchSetAttribute)).thenReturn(patchSetProperties);
 
     event.reason = "testReason";
     changeAttribute.project = "testProject";
@@ -191,25 +190,25 @@
   public void testCommentAddedEventWOApprovals() {
     CommentAddedEvent event = new CommentAddedEvent(testChange("testProject", "testBranch"));
 
-    expect(itsProjectExtractor.getItsProject("testProject")).andReturn(Optional.empty());
+    when(itsProjectExtractor.getItsProject("testProject")).thenReturn(Optional.empty());
 
-    ChangeAttribute changeAttribute = createMock(ChangeAttribute.class);
+    ChangeAttribute changeAttribute = mock(ChangeAttribute.class);
     event.change = Suppliers.ofInstance(changeAttribute);
     Map<String, String> changeProperties =
         ImmutableMap.of("project", "testProject", "changeNumber", "176");
-    expect(propertyAttributeExtractor.extractFrom(changeAttribute)).andReturn(changeProperties);
+    when(propertyAttributeExtractor.extractFrom(changeAttribute)).thenReturn(changeProperties);
 
-    AccountAttribute accountAttribute = createMock(AccountAttribute.class);
+    AccountAttribute accountAttribute = mock(AccountAttribute.class);
     event.author = Suppliers.ofInstance(accountAttribute);
     Map<String, String> accountProperties = ImmutableMap.of("commenterName", "testName");
-    expect(propertyAttributeExtractor.extractFrom(accountAttribute, "commenter"))
-        .andReturn(accountProperties);
+    when(propertyAttributeExtractor.extractFrom(accountAttribute, "commenter"))
+        .thenReturn(accountProperties);
 
-    PatchSetAttribute patchSetAttribute = createMock(PatchSetAttribute.class);
+    PatchSetAttribute patchSetAttribute = mock(PatchSetAttribute.class);
     event.patchSet = Suppliers.ofInstance(patchSetAttribute);
     Map<String, String> patchSetProperties =
         ImmutableMap.of("revision", "testRevision", "patchSetNumber", "3");
-    expect(propertyAttributeExtractor.extractFrom(patchSetAttribute)).andReturn(patchSetProperties);
+    when(propertyAttributeExtractor.extractFrom(patchSetAttribute)).thenReturn(patchSetProperties);
 
     event.comment = "testComment";
     changeAttribute.project = "testProject";
@@ -232,34 +231,34 @@
   public void testCommentAddedEventWApprovals() {
     CommentAddedEvent event = new CommentAddedEvent(testChange("testProject", "testBranch"));
 
-    expect(itsProjectExtractor.getItsProject("testProject")).andReturn(Optional.empty());
+    when(itsProjectExtractor.getItsProject("testProject")).thenReturn(Optional.empty());
 
-    ChangeAttribute changeAttribute = createMock(ChangeAttribute.class);
+    ChangeAttribute changeAttribute = mock(ChangeAttribute.class);
     event.change = Suppliers.ofInstance(changeAttribute);
     Map<String, String> changeProperties =
         ImmutableMap.of("project", "testProject", "changeNumber", "176");
-    expect(propertyAttributeExtractor.extractFrom(changeAttribute)).andReturn(changeProperties);
+    when(propertyAttributeExtractor.extractFrom(changeAttribute)).thenReturn(changeProperties);
 
-    AccountAttribute accountAttribute = createMock(AccountAttribute.class);
+    AccountAttribute accountAttribute = mock(AccountAttribute.class);
     event.author = Suppliers.ofInstance(accountAttribute);
     Map<String, String> accountProperties = ImmutableMap.of("commenterName", "testName");
-    expect(propertyAttributeExtractor.extractFrom(accountAttribute, "commenter"))
-        .andReturn(accountProperties);
+    when(propertyAttributeExtractor.extractFrom(accountAttribute, "commenter"))
+        .thenReturn(accountProperties);
 
-    PatchSetAttribute patchSetAttribute = createMock(PatchSetAttribute.class);
+    PatchSetAttribute patchSetAttribute = mock(PatchSetAttribute.class);
     event.patchSet = Suppliers.ofInstance(patchSetAttribute);
     Map<String, String> patchSetProperties =
         ImmutableMap.of("revision", "testRevision", "patchSetNumber", "3");
-    expect(propertyAttributeExtractor.extractFrom(patchSetAttribute)).andReturn(patchSetProperties);
+    when(propertyAttributeExtractor.extractFrom(patchSetAttribute)).thenReturn(patchSetProperties);
 
-    ApprovalAttribute approvalAttribute1 = createMock(ApprovalAttribute.class);
+    ApprovalAttribute approvalAttribute1 = mock(ApprovalAttribute.class);
     Map<String, String> approuvalProperties1 = ImmutableMap.of("approvalCodeReview", "0");
-    expect(propertyAttributeExtractor.extractFrom(approvalAttribute1))
-        .andReturn(approuvalProperties1);
-    ApprovalAttribute approvalAttribute2 = createMock(ApprovalAttribute.class);
+    when(propertyAttributeExtractor.extractFrom(approvalAttribute1))
+        .thenReturn(approuvalProperties1);
+    ApprovalAttribute approvalAttribute2 = mock(ApprovalAttribute.class);
     Map<String, String> approuvalProperties2 = ImmutableMap.of("approvalVerified", "0");
-    expect(propertyAttributeExtractor.extractFrom(approvalAttribute2))
-        .andReturn(approuvalProperties2);
+    when(propertyAttributeExtractor.extractFrom(approvalAttribute2))
+        .thenReturn(approuvalProperties2);
     ApprovalAttribute[] approvalAttributes = {approvalAttribute1, approvalAttribute2};
     event.approvals = Suppliers.ofInstance(approvalAttributes);
 
@@ -286,25 +285,25 @@
   public void testPatchSetCreatedEvent() {
     PatchSetCreatedEvent event = new PatchSetCreatedEvent(testChange("testProject", "testBranch"));
 
-    expect(itsProjectExtractor.getItsProject("testProject")).andReturn(Optional.empty());
+    when(itsProjectExtractor.getItsProject("testProject")).thenReturn(Optional.empty());
 
-    ChangeAttribute changeAttribute = createMock(ChangeAttribute.class);
+    ChangeAttribute changeAttribute = mock(ChangeAttribute.class);
     event.change = Suppliers.ofInstance(changeAttribute);
     Map<String, String> changeProperties =
         ImmutableMap.of("project", "testProject", "changeNumber", "176");
-    expect(propertyAttributeExtractor.extractFrom(changeAttribute)).andReturn(changeProperties);
+    when(propertyAttributeExtractor.extractFrom(changeAttribute)).thenReturn(changeProperties);
 
-    AccountAttribute accountAttribute = createMock(AccountAttribute.class);
+    AccountAttribute accountAttribute = mock(AccountAttribute.class);
     event.uploader = Suppliers.ofInstance(accountAttribute);
     Map<String, String> accountProperties = ImmutableMap.of("uploaderName", "testName");
-    expect(propertyAttributeExtractor.extractFrom(accountAttribute, "uploader"))
-        .andReturn(accountProperties);
+    when(propertyAttributeExtractor.extractFrom(accountAttribute, "uploader"))
+        .thenReturn(accountProperties);
 
-    PatchSetAttribute patchSetAttribute = createMock(PatchSetAttribute.class);
+    PatchSetAttribute patchSetAttribute = mock(PatchSetAttribute.class);
     event.patchSet = Suppliers.ofInstance(patchSetAttribute);
     Map<String, String> patchSetProperties =
         ImmutableMap.of("revision", "testRevision", "patchSetNumber", "3");
-    expect(propertyAttributeExtractor.extractFrom(patchSetAttribute)).andReturn(patchSetProperties);
+    when(propertyAttributeExtractor.extractFrom(patchSetAttribute)).thenReturn(patchSetProperties);
 
     changeAttribute.project = "testProject";
     changeAttribute.number = 176;
@@ -325,25 +324,25 @@
   public void testRefUpdatedEvent() {
     RefUpdatedEvent event = new RefUpdatedEvent();
 
-    AccountAttribute accountAttribute = createMock(AccountAttribute.class);
+    AccountAttribute accountAttribute = mock(AccountAttribute.class);
     event.submitter = Suppliers.ofInstance(accountAttribute);
     Map<String, String> accountProperties = ImmutableMap.of("submitterName", "testName");
-    expect(propertyAttributeExtractor.extractFrom(accountAttribute, "submitter"))
-        .andReturn(accountProperties);
+    when(propertyAttributeExtractor.extractFrom(accountAttribute, "submitter"))
+        .thenReturn(accountProperties);
 
-    RefUpdateAttribute refUpdateAttribute = createMock(RefUpdateAttribute.class);
+    RefUpdateAttribute refUpdateAttribute = mock(RefUpdateAttribute.class);
     event.refUpdate = Suppliers.ofInstance(refUpdateAttribute);
     Map<String, String> refUpdatedProperties =
         ImmutableMap.of("revision", "testRevision", "revisionOld", "oldRevision");
-    expect(propertyAttributeExtractor.extractFrom(refUpdateAttribute))
-        .andReturn(refUpdatedProperties);
+    when(propertyAttributeExtractor.extractFrom(refUpdateAttribute))
+        .thenReturn(refUpdatedProperties);
 
     refUpdateAttribute.project = "testProject";
     refUpdateAttribute.newRev = "testRevision";
     refUpdateAttribute.oldRev = "oldRevision";
     refUpdateAttribute.refName = "testBranch";
 
-    expect(itsProjectExtractor.getItsProject("testProject")).andReturn(Optional.empty());
+    when(itsProjectExtractor.getItsProject("testProject")).thenReturn(Optional.empty());
 
     Map<String, String> common =
         ImmutableMap.<String, String>builder()
@@ -369,14 +368,12 @@
     issueMap.put("42", Sets.newHashSet("footer", "anywhere"));
     if (withRevision) {
       PatchSet.Id patchSetId = PatchSet.id(Change.id(176), 3);
-      expect(issueExtractor.getIssueIds("testProject", "testRevision", patchSetId))
-          .andReturn(issueMap);
+      when(issueExtractor.getIssueIds("testProject", "testRevision", patchSetId))
+          .thenReturn(issueMap);
     } else {
-      expect(issueExtractor.getIssueIds("testProject", "testRevision")).andReturn(issueMap);
+      when(issueExtractor.getIssueIds("testProject", "testRevision")).thenReturn(issueMap);
     }
 
-    replayMocks();
-
     Set<Map<String, String>> actual = propertyExtractor.extractFrom(event).getIssuesProperties();
 
     Map<String, String> propertiesIssue4711 =
@@ -415,13 +412,13 @@
     protected void configure() {
       bind(String.class).annotatedWith(PluginName.class).toInstance("ItsTestName");
 
-      itsProjectExtractor = createMock(ItsProjectExtractor.class);
+      itsProjectExtractor = mock(ItsProjectExtractor.class);
       bind(ItsProjectExtractor.class).toInstance(itsProjectExtractor);
 
-      issueExtractor = createMock(IssueExtractor.class);
+      issueExtractor = mock(IssueExtractor.class);
       bind(IssueExtractor.class).toInstance(issueExtractor);
 
-      propertyAttributeExtractor = createMock(PropertyAttributeExtractor.class);
+      propertyAttributeExtractor = mock(PropertyAttributeExtractor.class);
       bind(PropertyAttributeExtractor.class).toInstance(propertyAttributeExtractor);
     }
   }
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/validation/ItsValidateCommentTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/validation/ItsValidateCommentTest.java
index e03b69f..433c43e 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/validation/ItsValidateCommentTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/validation/ItsValidateCommentTest.java
@@ -15,7 +15,11 @@
 
 import static com.google.common.truth.Truth.assertThat;
 import static com.google.gerrit.testing.GerritJUnit.assertThrows;
-import static org.easymock.EasyMock.expect;
+import static org.mockito.Mockito.atLeastOnce;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 import com.google.gerrit.entities.Project;
 import com.google.gerrit.extensions.annotations.PluginName;
@@ -32,17 +36,14 @@
 import com.googlesource.gerrit.plugins.its.base.testutil.LoggingMockingTestCase;
 import com.googlesource.gerrit.plugins.its.base.util.IssueExtractor;
 import java.io.IOException;
+import java.util.Date;
 import java.util.List;
 import java.util.Optional;
+import java.util.Random;
 import java.util.regex.Pattern;
 import org.eclipse.jgit.revwalk.RevCommit;
 import org.eclipse.jgit.transport.ReceiveCommand;
-import org.junit.runner.RunWith;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
 
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({RevCommit.class})
 public class ItsValidateCommentTest extends LoggingMockingTestCase {
   private Injector injector;
   private IssueExtractor issueExtractor;
@@ -55,38 +56,29 @@
   public void testOptional() throws CommitValidationException {
     List<CommitValidationMessage> ret;
     ItsValidateComment ivc = injector.getInstance(ItsValidateComment.class);
-    ReceiveCommand command = createMock(ReceiveCommand.class);
-    RevCommit commit = createMock(RevCommit.class);
+    ReceiveCommand command = mock(ReceiveCommand.class);
+    RevCommit commit = createCommit();
     CommitReceivedEvent event = newCommitReceivedEvent(command, project, null, commit, null);
 
-    expect(itsConfig.getItsAssociationPolicy())
-        .andReturn(ItsAssociationPolicy.OPTIONAL)
-        .atLeastOnce();
-
-    replayMocks();
+    when(itsConfig.getItsAssociationPolicy()).thenReturn(ItsAssociationPolicy.OPTIONAL);
 
     ret = ivc.onCommitReceived(event);
 
     assertEmptyList(ret);
+
+    verifyOneOrMore(itsConfig).getItsAssociationPolicy();
   }
 
   public void testSuggestedNonMatching() throws CommitValidationException {
     List<CommitValidationMessage> ret;
     ItsValidateComment ivc = injector.getInstance(ItsValidateComment.class);
-    ReceiveCommand command = createMock(ReceiveCommand.class);
-    RevCommit commit = createMock(RevCommit.class);
+    ReceiveCommand command = mock(ReceiveCommand.class);
+    RevCommit commit = createCommit("TestMessage");
     CommitReceivedEvent event = newCommitReceivedEvent(command, project, null, commit, null);
 
-    expect(itsConfig.getItsAssociationPolicy())
-        .andReturn(ItsAssociationPolicy.SUGGESTED)
-        .atLeastOnce();
-    expect(itsConfig.getDummyIssuePattern()).andReturn(Optional.empty()).atLeastOnce();
-    expect(commit.getFullMessage()).andReturn("TestMessage").atLeastOnce();
-    expect(commit.getId()).andReturn(commit).anyTimes();
-    expect(commit.getName()).andReturn("TestCommit").anyTimes();
-    expect(issueExtractor.getIssueIds("TestMessage")).andReturn(new String[] {}).atLeastOnce();
-
-    replayMocks();
+    when(itsConfig.getItsAssociationPolicy()).thenReturn(ItsAssociationPolicy.SUGGESTED);
+    when(itsConfig.getDummyIssuePattern()).thenReturn(Optional.empty());
+    when(issueExtractor.getIssueIds("TestMessage")).thenReturn(new String[] {});
 
     ret = ivc.onCommitReceived(event);
 
@@ -94,121 +86,104 @@
     assertTrue(
         "First CommitValidationMessages does not contain 'Missing " + "issue'",
         ret.get(0).getMessage().contains("Missing issue"));
+
+    verifyOneOrMore(itsConfig).getItsAssociationPolicy();
+    verifyOneOrMore(itsConfig).getDummyIssuePattern();
+    verifyOneOrMore(issueExtractor).getIssueIds("TestMessage");
   }
 
   public void testMandatoryNonMatching() {
     ItsValidateComment ivc = injector.getInstance(ItsValidateComment.class);
-    ReceiveCommand command = createMock(ReceiveCommand.class);
-    RevCommit commit = createMock(RevCommit.class);
+    ReceiveCommand command = mock(ReceiveCommand.class);
+    RevCommit commit = createCommit("TestMessage");
     CommitReceivedEvent event = newCommitReceivedEvent(command, project, null, commit, null);
 
-    expect(itsConfig.getItsAssociationPolicy())
-        .andReturn(ItsAssociationPolicy.MANDATORY)
-        .atLeastOnce();
-    expect(itsConfig.getDummyIssuePattern()).andReturn(Optional.empty()).atLeastOnce();
-    expect(commit.getFullMessage()).andReturn("TestMessage").atLeastOnce();
-    expect(commit.getId()).andReturn(commit).anyTimes();
-    expect(commit.getName()).andReturn("TestCommit").anyTimes();
-    expect(issueExtractor.getIssueIds("TestMessage")).andReturn(new String[] {}).atLeastOnce();
-
-    replayMocks();
+    when(itsConfig.getItsAssociationPolicy()).thenReturn(ItsAssociationPolicy.MANDATORY);
+    when(itsConfig.getDummyIssuePattern()).thenReturn(Optional.empty());
+    when(issueExtractor.getIssueIds("TestMessage")).thenReturn(new String[] {});
 
     CommitValidationException thrown =
         assertThrows(CommitValidationException.class, () -> ivc.onCommitReceived(event));
     assertThat(thrown).hasMessageThat().contains("Missing issue");
+
+    verifyOneOrMore(itsConfig).getItsAssociationPolicy();
+    verifyOneOrMore(itsConfig).getDummyIssuePattern();
+    verifyOneOrMore(issueExtractor).getIssueIds("TestMessage");
   }
 
   public void testOnlySkipMatching() throws CommitValidationException {
     List<CommitValidationMessage> ret;
     ItsValidateComment ivc = injector.getInstance(ItsValidateComment.class);
-    ReceiveCommand command = createMock(ReceiveCommand.class);
-    RevCommit commit = createMock(RevCommit.class);
+    ReceiveCommand command = mock(ReceiveCommand.class);
+    RevCommit commit = createCommit("TestMessage SKIP");
     CommitReceivedEvent event = newCommitReceivedEvent(command, project, null, commit, null);
 
-    expect(itsConfig.getItsAssociationPolicy())
-        .andReturn(ItsAssociationPolicy.MANDATORY)
-        .atLeastOnce();
-    expect(itsConfig.getDummyIssuePattern())
-        .andReturn(Optional.of(Pattern.compile("SKIP")))
-        .atLeastOnce();
-    expect(commit.getFullMessage()).andReturn("TestMessage SKIP").atLeastOnce();
-    expect(commit.getId()).andReturn(commit).anyTimes();
-    expect(commit.getName()).andReturn("TestCommit").anyTimes();
-    expect(issueExtractor.getIssueIds("TestMessage SKIP")).andReturn(new String[] {}).atLeastOnce();
-
-    replayMocks();
+    when(itsConfig.getItsAssociationPolicy()).thenReturn(ItsAssociationPolicy.MANDATORY);
+    when(itsConfig.getDummyIssuePattern()).thenReturn(Optional.of(Pattern.compile("SKIP")));
+    when(issueExtractor.getIssueIds("TestMessage SKIP")).thenReturn(new String[] {});
 
     ret = ivc.onCommitReceived(event);
 
     assertEmptyList(ret);
+
+    verifyOneOrMore(itsConfig).getItsAssociationPolicy();
+    verifyOneOrMore(itsConfig).getDummyIssuePattern();
+    verifyOneOrMore(issueExtractor).getIssueIds("TestMessage SKIP");
   }
 
   public void testSuggestedMatchingSingleExisting() throws CommitValidationException, IOException {
     List<CommitValidationMessage> ret;
     ItsValidateComment ivc = injector.getInstance(ItsValidateComment.class);
-    ReceiveCommand command = createMock(ReceiveCommand.class);
-    RevCommit commit = createMock(RevCommit.class);
+    ReceiveCommand command = mock(ReceiveCommand.class);
+    RevCommit commit = createCommit("bug#4711");
     CommitReceivedEvent event = newCommitReceivedEvent(command, project, null, commit, null);
-    expect(itsConfig.getItsAssociationPolicy())
-        .andReturn(ItsAssociationPolicy.SUGGESTED)
-        .atLeastOnce();
-    expect(commit.getFullMessage()).andReturn("bug#4711").atLeastOnce();
-    expect(commit.getId()).andReturn(commit).anyTimes();
-    expect(commit.getName()).andReturn("TestCommit").anyTimes();
-    expect(issueExtractor.getIssueIds("bug#4711")).andReturn(new String[] {"4711"}).atLeastOnce();
-    expect(itsFacadeFactory.getFacade(project.getNameKey())).andReturn(itsFacade);
-    expect(itsFacade.exists("4711")).andReturn(true).atLeastOnce();
-
-    replayMocks();
+    when(itsConfig.getItsAssociationPolicy()).thenReturn(ItsAssociationPolicy.SUGGESTED);
+    when(issueExtractor.getIssueIds("bug#4711")).thenReturn(new String[] {"4711"});
+    when(itsFacadeFactory.getFacade(project.getNameKey())).thenReturn(itsFacade);
+    when(itsFacade.exists("4711")).thenReturn(true);
 
     ret = ivc.onCommitReceived(event);
 
     assertEmptyList(ret);
+
+    verifyOneOrMore(itsConfig).getItsAssociationPolicy();
+    verifyOneOrMore(issueExtractor).getIssueIds("bug#4711");
+    verifyOneOrMore(itsFacade).exists("4711");
   }
 
   public void testMandatoryMatchingSingleExisting() throws CommitValidationException, IOException {
     List<CommitValidationMessage> ret;
     ItsValidateComment ivc = injector.getInstance(ItsValidateComment.class);
-    ReceiveCommand command = createMock(ReceiveCommand.class);
-    RevCommit commit = createMock(RevCommit.class);
+    ReceiveCommand command = mock(ReceiveCommand.class);
+    RevCommit commit = createCommit("bug#4711");
     CommitReceivedEvent event = newCommitReceivedEvent(command, project, null, commit, null);
 
-    expect(itsConfig.getItsAssociationPolicy())
-        .andReturn(ItsAssociationPolicy.MANDATORY)
-        .atLeastOnce();
-    expect(commit.getFullMessage()).andReturn("bug#4711").atLeastOnce();
-    expect(commit.getId()).andReturn(commit).anyTimes();
-    expect(commit.getName()).andReturn("TestCommit").anyTimes();
-    expect(issueExtractor.getIssueIds("bug#4711")).andReturn(new String[] {"4711"}).atLeastOnce();
-    expect(itsFacadeFactory.getFacade(project.getNameKey())).andReturn(itsFacade);
-    expect(itsFacade.exists("4711")).andReturn(true).atLeastOnce();
-
-    replayMocks();
+    when(itsConfig.getItsAssociationPolicy()).thenReturn(ItsAssociationPolicy.MANDATORY);
+    when(issueExtractor.getIssueIds("bug#4711")).thenReturn(new String[] {"4711"});
+    when(itsFacadeFactory.getFacade(project.getNameKey())).thenReturn(itsFacade);
+    when(itsFacade.exists("4711")).thenReturn(true);
 
     ret = ivc.onCommitReceived(event);
 
     assertEmptyList(ret);
+
+    verifyOneOrMore(itsConfig).getItsAssociationPolicy();
+    verifyOneOrMore(issueExtractor).getIssueIds("bug#4711");
+    verifyOneOrMore(itsFacade).exists("4711");
   }
 
   public void testSuggestedMatchingSingleNonExisting()
       throws CommitValidationException, IOException {
     List<CommitValidationMessage> ret;
     ItsValidateComment ivc = injector.getInstance(ItsValidateComment.class);
-    ReceiveCommand command = createMock(ReceiveCommand.class);
-    RevCommit commit = createMock(RevCommit.class);
+    ReceiveCommand command = mock(ReceiveCommand.class);
+    RevCommit commit = createCommit("bug#4711");
     CommitReceivedEvent event = newCommitReceivedEvent(command, project, null, commit, null);
 
-    expect(itsConfig.getItsAssociationPolicy())
-        .andReturn(ItsAssociationPolicy.SUGGESTED)
-        .atLeastOnce();
-    expect(commit.getFullMessage()).andReturn("bug#4711").atLeastOnce();
-    expect(commit.getId()).andReturn(commit).anyTimes();
-    expect(commit.getName()).andReturn("TestCommit").anyTimes();
-    expect(issueExtractor.getIssueIds("bug#4711")).andReturn(new String[] {"4711"}).atLeastOnce();
-    expect(itsFacadeFactory.getFacade(project.getNameKey())).andReturn(itsFacade);
-    expect(itsFacade.exists("4711")).andReturn(false).atLeastOnce();
-
-    replayMocks();
+    when(itsConfig.getItsAssociationPolicy()).thenReturn(ItsAssociationPolicy.SUGGESTED);
+    when(issueExtractor.getIssueIds("bug#4711")).thenReturn(new String[] {"4711"});
+    when(itsFacadeFactory.getFacade(project.getNameKey())).thenReturn(itsFacade);
+    when(itsFacade.exists("4711")).thenReturn(false);
 
     ret = ivc.onCommitReceived(event);
 
@@ -219,106 +194,90 @@
     assertTrue(
         "First CommitValidationMessages does not contain '4711'",
         ret.get(0).getMessage().contains("4711"));
+
+    verifyOneOrMore(itsConfig).getItsAssociationPolicy();
+    verifyOneOrMore(issueExtractor).getIssueIds("bug#4711");
+    verifyOneOrMore(itsFacade).exists("4711");
   }
 
   public void testMandatoryMatchingSingleNonExisting() throws IOException {
     ItsValidateComment ivc = injector.getInstance(ItsValidateComment.class);
-    ReceiveCommand command = createMock(ReceiveCommand.class);
-    RevCommit commit = createMock(RevCommit.class);
+    ReceiveCommand command = mock(ReceiveCommand.class);
+    RevCommit commit = createCommit("bug#4711");
     CommitReceivedEvent event = newCommitReceivedEvent(command, project, null, commit, null);
 
-    expect(itsConfig.getItsAssociationPolicy())
-        .andReturn(ItsAssociationPolicy.MANDATORY)
-        .atLeastOnce();
-    expect(commit.getFullMessage()).andReturn("bug#4711").atLeastOnce();
-    expect(commit.getId()).andReturn(commit).anyTimes();
-    expect(commit.getName()).andReturn("TestCommit").anyTimes();
-    expect(issueExtractor.getIssueIds("bug#4711")).andReturn(new String[] {"4711"}).atLeastOnce();
-    expect(itsFacadeFactory.getFacade(project.getNameKey())).andReturn(itsFacade);
-    expect(itsFacade.exists("4711")).andReturn(false).atLeastOnce();
-
-    replayMocks();
+    when(itsConfig.getItsAssociationPolicy()).thenReturn(ItsAssociationPolicy.MANDATORY);
+    when(issueExtractor.getIssueIds("bug#4711")).thenReturn(new String[] {"4711"});
+    when(itsFacadeFactory.getFacade(project.getNameKey())).thenReturn(itsFacade);
+    when(itsFacade.exists("4711")).thenReturn(false);
 
     CommitValidationException thrown =
         assertThrows(CommitValidationException.class, () -> ivc.onCommitReceived(event));
     assertThat(thrown).hasMessageThat().contains("Non-existing");
+
+    verifyOneOrMore(itsConfig).getItsAssociationPolicy();
+    verifyOneOrMore(issueExtractor).getIssueIds("bug#4711");
+    verifyOneOrMore(itsFacade).exists("4711");
   }
 
   public void testSuggestedMatchingMultiple() throws CommitValidationException, IOException {
     List<CommitValidationMessage> ret;
     ItsValidateComment ivc = injector.getInstance(ItsValidateComment.class);
-    ReceiveCommand command = createMock(ReceiveCommand.class);
-    RevCommit commit = createMock(RevCommit.class);
+    ReceiveCommand command = mock(ReceiveCommand.class);
+    RevCommit commit = createCommit("bug#4711, bug#42");
     CommitReceivedEvent event = newCommitReceivedEvent(command, project, null, commit, null);
 
-    expect(itsConfig.getItsAssociationPolicy())
-        .andReturn(ItsAssociationPolicy.SUGGESTED)
-        .atLeastOnce();
-    expect(commit.getFullMessage()).andReturn("bug#4711, bug#42").atLeastOnce();
-    expect(commit.getId()).andReturn(commit).anyTimes();
-    expect(commit.getName()).andReturn("TestCommit").anyTimes();
-    expect(issueExtractor.getIssueIds("bug#4711, bug#42"))
-        .andReturn(new String[] {"4711", "42"})
-        .atLeastOnce();
-    expect(itsFacadeFactory.getFacade(project.getNameKey())).andReturn(itsFacade).anyTimes();
-    expect(itsFacade.exists("4711")).andReturn(true).atLeastOnce();
-    expect(itsFacade.exists("42")).andReturn(true).atLeastOnce();
-
-    replayMocks();
+    when(itsConfig.getItsAssociationPolicy()).thenReturn(ItsAssociationPolicy.SUGGESTED);
+    when(issueExtractor.getIssueIds("bug#4711, bug#42")).thenReturn(new String[] {"4711", "42"});
+    when(itsFacadeFactory.getFacade(project.getNameKey())).thenReturn(itsFacade);
+    when(itsFacade.exists("4711")).thenReturn(true);
+    when(itsFacade.exists("42")).thenReturn(true);
 
     ret = ivc.onCommitReceived(event);
 
     assertEmptyList(ret);
+
+    verifyOneOrMore(itsConfig).getItsAssociationPolicy();
+    verifyOneOrMore(itsFacade).exists("4711");
+    verifyOneOrMore(itsFacade).exists("42");
   }
 
   public void testMandatoryMatchingMultiple() throws CommitValidationException, IOException {
     List<CommitValidationMessage> ret;
     ItsValidateComment ivc = injector.getInstance(ItsValidateComment.class);
-    ReceiveCommand command = createMock(ReceiveCommand.class);
-    RevCommit commit = createMock(RevCommit.class);
+    ReceiveCommand command = mock(ReceiveCommand.class);
+    RevCommit commit = createCommit("bug#4711, bug#42");
     CommitReceivedEvent event = newCommitReceivedEvent(command, project, null, commit, null);
 
-    expect(itsConfig.getItsAssociationPolicy())
-        .andReturn(ItsAssociationPolicy.MANDATORY)
-        .atLeastOnce();
-    expect(commit.getFullMessage()).andReturn("bug#4711, bug#42").atLeastOnce();
-    expect(commit.getId()).andReturn(commit).anyTimes();
-    expect(commit.getName()).andReturn("TestCommit").anyTimes();
-    expect(issueExtractor.getIssueIds("bug#4711, bug#42"))
-        .andReturn(new String[] {"4711", "42"})
-        .atLeastOnce();
-    expect(itsFacadeFactory.getFacade(project.getNameKey())).andReturn(itsFacade).anyTimes();
-    expect(itsFacade.exists("4711")).andReturn(true).atLeastOnce();
-    expect(itsFacade.exists("42")).andReturn(true).atLeastOnce();
-
-    replayMocks();
+    when(itsConfig.getItsAssociationPolicy()).thenReturn(ItsAssociationPolicy.MANDATORY);
+    when(issueExtractor.getIssueIds("bug#4711, bug#42")).thenReturn(new String[] {"4711", "42"});
+    when(itsFacadeFactory.getFacade(project.getNameKey())).thenReturn(itsFacade);
+    when(itsFacade.exists("4711")).thenReturn(true);
+    when(itsFacade.exists("42")).thenReturn(true);
 
     ret = ivc.onCommitReceived(event);
 
     assertEmptyList(ret);
+
+    verifyOneOrMore(itsConfig).getItsAssociationPolicy();
+    verifyOneOrMore(issueExtractor).getIssueIds("bug#4711, bug#42");
+    verifyOneOrMore(itsFacade).exists("4711");
+    verifyOneOrMore(itsFacade).exists("42");
   }
 
   public void testSuggestedMatchingMultipleOneNonExsting()
       throws CommitValidationException, IOException {
     List<CommitValidationMessage> ret;
     ItsValidateComment ivc = injector.getInstance(ItsValidateComment.class);
-    ReceiveCommand command = createMock(ReceiveCommand.class);
-    RevCommit commit = createMock(RevCommit.class);
+    ReceiveCommand command = mock(ReceiveCommand.class);
+    RevCommit commit = createCommit("bug#4711, bug#42");
     CommitReceivedEvent event = newCommitReceivedEvent(command, project, null, commit, null);
 
-    expect(itsConfig.getItsAssociationPolicy())
-        .andReturn(ItsAssociationPolicy.SUGGESTED)
-        .atLeastOnce();
-    expect(commit.getFullMessage()).andReturn("bug#4711, bug#42").atLeastOnce();
-    expect(commit.getId()).andReturn(commit).anyTimes();
-    expect(commit.getName()).andReturn("TestCommit").anyTimes();
-    expect(issueExtractor.getIssueIds("bug#4711, bug#42"))
-        .andReturn(new String[] {"4711", "42"})
-        .atLeastOnce();
-    expect(itsFacadeFactory.getFacade(project.getNameKey())).andReturn(itsFacade).anyTimes();
-    expect(itsFacade.exists("4711")).andReturn(false).atLeastOnce();
-    expect(itsFacade.exists("42")).andReturn(true).atLeastOnce();
-    replayMocks();
+    when(itsConfig.getItsAssociationPolicy()).thenReturn(ItsAssociationPolicy.SUGGESTED);
+    when(issueExtractor.getIssueIds("bug#4711, bug#42")).thenReturn(new String[] {"4711", "42"});
+    when(itsFacadeFactory.getFacade(project.getNameKey())).thenReturn(itsFacade);
+    when(itsFacade.exists("4711")).thenReturn(false);
+    when(itsFacade.exists("42")).thenReturn(true);
 
     ret = ivc.onCommitReceived(event);
 
@@ -332,56 +291,48 @@
     assertFalse(
         "First CommitValidationMessages contains '42', although " + "that bug exists",
         ret.get(0).getMessage().contains("42"));
+
+    verifyOneOrMore(itsConfig).getItsAssociationPolicy();
+    verifyOneOrMore(issueExtractor).getIssueIds("bug#4711, bug#42");
+    verifyOneOrMore(itsFacade).exists("4711");
+    verifyOneOrMore(itsFacade).exists("42");
   }
 
   public void testMandatoryMatchingMultipleOneNonExsting() throws IOException {
     ItsValidateComment ivc = injector.getInstance(ItsValidateComment.class);
-    ReceiveCommand command = createMock(ReceiveCommand.class);
-    RevCommit commit = createMock(RevCommit.class);
+    ReceiveCommand command = mock(ReceiveCommand.class);
+    RevCommit commit = createCommit("bug#4711, bug#42");
     CommitReceivedEvent event = newCommitReceivedEvent(command, project, null, commit, null);
 
-    expect(itsConfig.getItsAssociationPolicy())
-        .andReturn(ItsAssociationPolicy.MANDATORY)
-        .atLeastOnce();
-    expect(commit.getFullMessage()).andReturn("bug#4711, bug#42").atLeastOnce();
-    expect(commit.getId()).andReturn(commit).anyTimes();
-    expect(commit.getName()).andReturn("TestCommit").anyTimes();
-    expect(issueExtractor.getIssueIds("bug#4711, bug#42"))
-        .andReturn(new String[] {"4711", "42"})
-        .atLeastOnce();
-    expect(itsFacadeFactory.getFacade(project.getNameKey())).andReturn(itsFacade).anyTimes();
-    expect(itsFacade.exists("4711")).andReturn(false).atLeastOnce();
-    expect(itsFacade.exists("42")).andReturn(true).atLeastOnce();
-
-    replayMocks();
+    when(itsConfig.getItsAssociationPolicy()).thenReturn(ItsAssociationPolicy.MANDATORY);
+    when(issueExtractor.getIssueIds("bug#4711, bug#42")).thenReturn(new String[] {"4711", "42"});
+    when(itsFacadeFactory.getFacade(project.getNameKey())).thenReturn(itsFacade);
+    when(itsFacade.exists("4711")).thenReturn(false);
+    when(itsFacade.exists("42")).thenReturn(true);
 
     CommitValidationException thrown =
         assertThrows(CommitValidationException.class, () -> ivc.onCommitReceived(event));
     assertThat(thrown).hasMessageThat().contains("Non-existing");
+
+    verifyOneOrMore(itsConfig).getItsAssociationPolicy();
+    verifyOneOrMore(issueExtractor).getIssueIds("bug#4711, bug#42");
+    verifyOneOrMore(itsFacade).exists("4711");
+    verifyOneOrMore(itsFacade).exists("42");
   }
 
   public void testSuggestedMatchingMultipleSomeNonExsting()
       throws CommitValidationException, IOException {
     List<CommitValidationMessage> ret;
     ItsValidateComment ivc = injector.getInstance(ItsValidateComment.class);
-    ReceiveCommand command = createMock(ReceiveCommand.class);
-    RevCommit commit = createMock(RevCommit.class);
+    ReceiveCommand command = mock(ReceiveCommand.class);
+    RevCommit commit = createCommit("bug#4711, bug#42");
     CommitReceivedEvent event = newCommitReceivedEvent(command, project, null, commit, null);
 
-    expect(itsConfig.getItsAssociationPolicy())
-        .andReturn(ItsAssociationPolicy.SUGGESTED)
-        .atLeastOnce();
-    expect(commit.getFullMessage()).andReturn("bug#4711, bug#42").atLeastOnce();
-    expect(commit.getId()).andReturn(commit).anyTimes();
-    expect(commit.getName()).andReturn("TestCommit").anyTimes();
-    expect(issueExtractor.getIssueIds("bug#4711, bug#42"))
-        .andReturn(new String[] {"4711", "42"})
-        .atLeastOnce();
-    expect(itsFacadeFactory.getFacade(project.getNameKey())).andReturn(itsFacade).anyTimes();
-    expect(itsFacade.exists("4711")).andReturn(false).atLeastOnce();
-    expect(itsFacade.exists("42")).andReturn(false).atLeastOnce();
-
-    replayMocks();
+    when(itsConfig.getItsAssociationPolicy()).thenReturn(ItsAssociationPolicy.SUGGESTED);
+    when(issueExtractor.getIssueIds("bug#4711, bug#42")).thenReturn(new String[] {"4711", "42"});
+    when(itsFacadeFactory.getFacade(project.getNameKey())).thenReturn(itsFacade);
+    when(itsFacade.exists("4711")).thenReturn(false);
+    when(itsFacade.exists("42")).thenReturn(false);
 
     ret = ivc.onCommitReceived(event);
 
@@ -395,56 +346,48 @@
     assertTrue(
         "First CommitValidationMessages does not contain '42'",
         ret.get(0).getMessage().contains("42"));
+
+    verifyOneOrMore(itsConfig).getItsAssociationPolicy();
+    verifyOneOrMore(issueExtractor).getIssueIds("bug#4711, bug#42");
+    verifyOneOrMore(itsFacade).exists("4711");
+    verifyOneOrMore(itsFacade).exists("42");
   }
 
   public void testMandatoryMatchingMultipleSomeNonExsting() throws IOException {
     ItsValidateComment ivc = injector.getInstance(ItsValidateComment.class);
-    ReceiveCommand command = createMock(ReceiveCommand.class);
-    RevCommit commit = createMock(RevCommit.class);
+    ReceiveCommand command = mock(ReceiveCommand.class);
+    RevCommit commit = createCommit("bug#4711, bug#42");
     CommitReceivedEvent event = newCommitReceivedEvent(command, project, null, commit, null);
 
-    expect(itsConfig.getItsAssociationPolicy())
-        .andReturn(ItsAssociationPolicy.MANDATORY)
-        .atLeastOnce();
-    expect(commit.getFullMessage()).andReturn("bug#4711, bug#42").atLeastOnce();
-    expect(commit.getId()).andReturn(commit).anyTimes();
-    expect(commit.getName()).andReturn("TestCommit").anyTimes();
-    expect(issueExtractor.getIssueIds("bug#4711, bug#42"))
-        .andReturn(new String[] {"4711", "42"})
-        .atLeastOnce();
-    expect(itsFacadeFactory.getFacade(project.getNameKey())).andReturn(itsFacade).anyTimes();
-    expect(itsFacade.exists("4711")).andReturn(false).atLeastOnce();
-    expect(itsFacade.exists("42")).andReturn(true).atLeastOnce();
-
-    replayMocks();
+    when(itsConfig.getItsAssociationPolicy()).thenReturn(ItsAssociationPolicy.MANDATORY);
+    when(issueExtractor.getIssueIds("bug#4711, bug#42")).thenReturn(new String[] {"4711", "42"});
+    when(itsFacadeFactory.getFacade(project.getNameKey())).thenReturn(itsFacade);
+    when(itsFacade.exists("4711")).thenReturn(false);
+    when(itsFacade.exists("42")).thenReturn(true);
 
     CommitValidationException thrown =
         assertThrows(CommitValidationException.class, () -> ivc.onCommitReceived(event));
     assertThat(thrown).hasMessageThat().contains("Non-existing");
+
+    verifyOneOrMore(itsConfig).getItsAssociationPolicy();
+    verifyOneOrMore(issueExtractor).getIssueIds("bug#4711, bug#42");
+    verifyOneOrMore(itsFacade).exists("4711");
+    verifyOneOrMore(itsFacade).exists("42");
   }
 
   public void testSuggestedMatchingMultipleIOExceptionIsNonExsting()
       throws CommitValidationException, IOException {
     List<CommitValidationMessage> ret;
     ItsValidateComment ivc = injector.getInstance(ItsValidateComment.class);
-    ReceiveCommand command = createMock(ReceiveCommand.class);
-    RevCommit commit = createMock(RevCommit.class);
+    ReceiveCommand command = mock(ReceiveCommand.class);
+    RevCommit commit = createCommit("bug#4711, bug#42");
     CommitReceivedEvent event = newCommitReceivedEvent(command, project, null, commit, null);
 
-    expect(itsConfig.getItsAssociationPolicy())
-        .andReturn(ItsAssociationPolicy.SUGGESTED)
-        .atLeastOnce();
-    expect(commit.getFullMessage()).andReturn("bug#4711, bug#42").atLeastOnce();
-    expect(commit.getId()).andReturn(commit).anyTimes();
-    expect(commit.getName()).andReturn("TestCommit").anyTimes();
-    expect(issueExtractor.getIssueIds("bug#4711, bug#42"))
-        .andReturn(new String[] {"4711", "42"})
-        .atLeastOnce();
-    expect(itsFacadeFactory.getFacade(project.getNameKey())).andReturn(itsFacade).anyTimes();
-    expect(itsFacade.exists("4711")).andThrow(new IOException("InjectedEx1")).atLeastOnce();
-    expect(itsFacade.exists("42")).andReturn(false).atLeastOnce();
-
-    replayMocks();
+    when(itsConfig.getItsAssociationPolicy()).thenReturn(ItsAssociationPolicy.SUGGESTED);
+    when(issueExtractor.getIssueIds("bug#4711, bug#42")).thenReturn(new String[] {"4711", "42"});
+    when(itsFacadeFactory.getFacade(project.getNameKey())).thenReturn(itsFacade);
+    doThrow(new IOException("InjectedEx1")).when(itsFacade).exists("4711");
+    when(itsFacade.exists("42")).thenReturn(false);
 
     ret = ivc.onCommitReceived(event);
 
@@ -470,27 +413,25 @@
         ret.get(1).getMessage().contains("42"));
 
     assertLogMessageContains("4711");
+
+    verifyOneOrMore(itsConfig).getItsAssociationPolicy();
+    verifyOneOrMore(issueExtractor).getIssueIds("bug#4711, bug#42");
+    verifyOneOrMore(itsFacade).exists("4711");
+    verifyOneOrMore(itsFacade).exists("42");
   }
 
   public void testMandatoryMatchingSingleIOException()
       throws CommitValidationException, IOException {
     List<CommitValidationMessage> ret;
     ItsValidateComment ivc = injector.getInstance(ItsValidateComment.class);
-    ReceiveCommand command = createMock(ReceiveCommand.class);
-    RevCommit commit = createMock(RevCommit.class);
+    ReceiveCommand command = mock(ReceiveCommand.class);
+    RevCommit commit = createCommit("bug#4711");
     CommitReceivedEvent event = newCommitReceivedEvent(command, project, null, commit, null);
 
-    expect(itsConfig.getItsAssociationPolicy())
-        .andReturn(ItsAssociationPolicy.MANDATORY)
-        .atLeastOnce();
-    expect(commit.getFullMessage()).andReturn("bug#4711").atLeastOnce();
-    expect(commit.getId()).andReturn(commit).anyTimes();
-    expect(commit.getName()).andReturn("TestCommit").anyTimes();
-    expect(issueExtractor.getIssueIds("bug#4711")).andReturn(new String[] {"4711"}).atLeastOnce();
-    expect(itsFacadeFactory.getFacade(project.getNameKey())).andReturn(itsFacade).anyTimes();
-    expect(itsFacade.exists("4711")).andThrow(new IOException("InjectedEx1")).atLeastOnce();
-
-    replayMocks();
+    when(itsConfig.getItsAssociationPolicy()).thenReturn(ItsAssociationPolicy.MANDATORY);
+    when(issueExtractor.getIssueIds("bug#4711")).thenReturn(new String[] {"4711"});
+    when(itsFacadeFactory.getFacade(project.getNameKey())).thenReturn(itsFacade);
+    doThrow(new IOException("InjectedEx1")).when(itsFacade).exists("4711");
 
     ret = ivc.onCommitReceived(event);
 
@@ -506,29 +447,23 @@
         ret.get(0).getMessage().contains("InjectedEx1"));
 
     assertLogMessageContains("4711");
+
+    verifyOneOrMore(itsConfig).getItsAssociationPolicy();
+    verifyOneOrMore(issueExtractor).getIssueIds("bug#4711");
+    verifyOneOrMore(itsFacade).exists("4711");
   }
 
   public void testMandatoryMatchingMultipleIOExceptionIsNonExisting() throws IOException {
-    List<CommitValidationMessage> ret;
     ItsValidateComment ivc = injector.getInstance(ItsValidateComment.class);
-    ReceiveCommand command = createMock(ReceiveCommand.class);
-    RevCommit commit = createMock(RevCommit.class);
+    ReceiveCommand command = mock(ReceiveCommand.class);
+    RevCommit commit = createCommit("bug#4711, bug#42");
     CommitReceivedEvent event = newCommitReceivedEvent(command, project, null, commit, null);
 
-    expect(itsConfig.getItsAssociationPolicy())
-        .andReturn(ItsAssociationPolicy.MANDATORY)
-        .atLeastOnce();
-    expect(commit.getFullMessage()).andReturn("bug#4711, bug#42").atLeastOnce();
-    expect(commit.getId()).andReturn(commit).anyTimes();
-    expect(commit.getName()).andReturn("TestCommit").anyTimes();
-    expect(issueExtractor.getIssueIds("bug#4711, bug#42"))
-        .andReturn(new String[] {"4711", "42"})
-        .atLeastOnce();
-    expect(itsFacadeFactory.getFacade(project.getNameKey())).andReturn(itsFacade).anyTimes();
-    expect(itsFacade.exists("4711")).andThrow(new IOException("InjectedEx1")).atLeastOnce();
-    expect(itsFacade.exists("42")).andReturn(false).atLeastOnce();
-
-    replayMocks();
+    when(itsConfig.getItsAssociationPolicy()).thenReturn(ItsAssociationPolicy.MANDATORY);
+    when(issueExtractor.getIssueIds("bug#4711, bug#42")).thenReturn(new String[] {"4711", "42"});
+    when(itsFacadeFactory.getFacade(project.getNameKey())).thenReturn(itsFacade);
+    doThrow(new IOException("InjectedEx1")).when(itsFacade).exists("4711");
+    when(itsFacade.exists("42")).thenReturn(false);
 
     try {
       ivc.onCommitReceived(event);
@@ -539,30 +474,26 @@
           "Message of thrown CommitValidationException does not " + "contain 'Non-existing'",
           e.getMessage().contains("Non-existing"));
     }
+
+    verifyOneOrMore(itsConfig).getItsAssociationPolicy();
+    verifyOneOrMore(issueExtractor).getIssueIds("bug#4711, bug#42");
+    verifyOneOrMore(itsFacade).exists("4711");
+    verifyOneOrMore(itsFacade).exists("42");
   }
 
   public void testMandatoryMatchingMultipleIOExceptionExisting()
       throws CommitValidationException, IOException {
     List<CommitValidationMessage> ret;
     ItsValidateComment ivc = injector.getInstance(ItsValidateComment.class);
-    ReceiveCommand command = createMock(ReceiveCommand.class);
-    RevCommit commit = createMock(RevCommit.class);
+    ReceiveCommand command = mock(ReceiveCommand.class);
+    RevCommit commit = createCommit("bug#4711, bug#42");
     CommitReceivedEvent event = newCommitReceivedEvent(command, project, null, commit, null);
 
-    expect(itsConfig.getItsAssociationPolicy())
-        .andReturn(ItsAssociationPolicy.MANDATORY)
-        .atLeastOnce();
-    expect(commit.getFullMessage()).andReturn("bug#4711, bug#42").atLeastOnce();
-    expect(commit.getId()).andReturn(commit).anyTimes();
-    expect(commit.getName()).andReturn("TestCommit").anyTimes();
-    expect(issueExtractor.getIssueIds("bug#4711, bug#42"))
-        .andReturn(new String[] {"4711", "42"})
-        .atLeastOnce();
-    expect(itsFacadeFactory.getFacade(project.getNameKey())).andReturn(itsFacade).anyTimes();
-    expect(itsFacade.exists("4711")).andThrow(new IOException("InjectedEx1")).atLeastOnce();
-    expect(itsFacade.exists("42")).andReturn(true).atLeastOnce();
-
-    replayMocks();
+    when(itsConfig.getItsAssociationPolicy()).thenReturn(ItsAssociationPolicy.MANDATORY);
+    when(issueExtractor.getIssueIds("bug#4711, bug#42")).thenReturn(new String[] {"4711", "42"});
+    when(itsFacadeFactory.getFacade(project.getNameKey())).thenReturn(itsFacade);
+    doThrow(new IOException("InjectedEx1")).when(itsFacade).exists("4711");
+    when(itsFacade.exists("42")).thenReturn(true);
 
     ret = ivc.onCommitReceived(event);
 
@@ -578,6 +509,11 @@
         ret.get(0).getMessage().contains("InjectedEx1"));
 
     assertLogMessageContains("4711");
+
+    verifyOneOrMore(itsConfig).getItsAssociationPolicy();
+    verifyOneOrMore(issueExtractor).getIssueIds("bug#4711, bug#42");
+    verifyOneOrMore(itsFacade).exists("4711");
+    verifyOneOrMore(itsFacade).exists("42");
   }
 
   public void assertEmptyList(List<CommitValidationMessage> list) {
@@ -593,9 +529,9 @@
   }
 
   private void setupCommonMocks() {
-    expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d+)")).anyTimes();
+    when(itsConfig.getIssuePattern()).thenReturn(Pattern.compile("bug#(\\d+)"));
     Project.NameKey projectNK = Project.nameKey("myProject");
-    expect(itsConfig.isEnabled(projectNK, null)).andReturn(true).anyTimes();
+    when(itsConfig.isEnabled(projectNK, null)).thenReturn(true);
   }
 
   @Override
@@ -613,32 +549,56 @@
       String refName,
       RevCommit commit,
       IdentifiedUser user) {
-    CommitReceivedEvent event = createMock(CommitReceivedEvent.class);
+    CommitReceivedEvent event = mock(CommitReceivedEvent.class);
     event.command = command;
     event.project = project;
     event.refName = refName;
     event.commit = commit;
     event.user = user;
-    expect(event.getProjectNameKey()).andReturn(project.getNameKey()).anyTimes();
-    expect(event.getRefName()).andReturn(null).anyTimes();
+    when(event.getProjectNameKey()).thenReturn(project.getNameKey());
+    when(event.getRefName()).thenReturn(null);
     return event;
   }
 
+  private RevCommit createCommit() {
+    return createCommit("Hello world");
+  }
+
+  private RevCommit createCommit(String fullMessage) {
+    String parents = String.format("parent %040x\n", new java.util.Random().nextLong());
+    String commitData =
+        String.format(
+            "tree %040x\n"
+                + parents
+                + "author John Doe <john@doe.com> %d +0100\n"
+                + "committer John Doe <john@doe.com> %d +0100\n\n"
+                + "%s",
+            new Random().nextLong(),
+            new Date().getTime(),
+            new Date().getTime(),
+            fullMessage);
+    return RevCommit.parse(commitData.getBytes());
+  }
+
+  private <T> T verifyOneOrMore(T mock) {
+    return verify(mock, atLeastOnce());
+  }
+
   private class TestModule extends FactoryModule {
     @Override
     protected void configure() {
       bind(String.class).annotatedWith(PluginName.class).toInstance("ItsTestName");
 
-      issueExtractor = createMock(IssueExtractor.class);
+      issueExtractor = mock(IssueExtractor.class);
       bind(IssueExtractor.class).toInstance(issueExtractor);
 
-      itsFacade = createMock(ItsFacade.class);
+      itsFacade = mock(ItsFacade.class);
       bind(ItsFacade.class).toInstance(itsFacade);
 
-      itsConfig = createMock(ItsConfig.class);
+      itsConfig = mock(ItsConfig.class);
       bind(ItsConfig.class).toInstance(itsConfig);
 
-      itsFacadeFactory = createMock(ItsFacadeFactory.class);
+      itsFacadeFactory = mock(ItsFacadeFactory.class);
       bind(ItsFacadeFactory.class).toInstance(itsFacadeFactory);
     }
   }
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/ActionControllerTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/ActionControllerTest.java
index bd32089..3653d26 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/ActionControllerTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/ActionControllerTest.java
@@ -13,8 +13,10 @@
 // limitations under the License.
 package com.googlesource.gerrit.plugins.its.base.workflow;
 
-import static org.easymock.EasyMock.anyObject;
-import static org.easymock.EasyMock.expect;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
@@ -44,14 +46,11 @@
   public void testNoPropertySets() {
     ActionController actionController = createActionController();
 
-    ChangeEvent event = createMock(ChangeEvent.class);
+    ChangeEvent event = mock(ChangeEvent.class);
 
     Set<Map<String, String>> propertySets = new HashSet<>();
-    expect(propertyExtractor.extractFrom(event))
-        .andReturn(new RefEventProperties(Collections.emptyMap(), propertySets))
-        .anyTimes();
-
-    replayMocks();
+    when(propertyExtractor.extractFrom(event))
+        .thenReturn(new RefEventProperties(Collections.emptyMap(), propertySets));
 
     actionController.onEvent(event);
   }
@@ -59,22 +58,22 @@
   public void testNoActionsOrNoIssues() {
     ActionController actionController = createActionController();
 
-    ChangeEvent event = createMock(ChangeEvent.class);
+    ChangeEvent event = mock(ChangeEvent.class);
 
     Set<Map<String, String>> propertySets = new HashSet<>();
     Map<String, String> properties = ImmutableMap.of("fake", "property");
     propertySets.add(properties);
 
-    expect(propertyExtractor.extractFrom(event))
-        .andReturn(new RefEventProperties(properties, propertySets))
-        .anyTimes();
+    when(propertyExtractor.extractFrom(event))
+        .thenReturn(new RefEventProperties(properties, propertySets));
 
     // When no issues are found in the commit message, the list of actions is empty
     // as there are no matchs with an empty map of properties.
     Collection<ActionRequest> actions = Collections.emptySet();
-    expect(ruleBase.actionRequestsFor(properties)).andReturn(actions).times(2);
-
-    replayMocks();
+    when(ruleBase.actionRequestsFor(properties))
+        .thenReturn(actions)
+        .thenReturn(actions)
+        .thenThrow(new UnsupportedOperationException("Method called more than twice"));
 
     actionController.onEvent(event);
   }
@@ -82,7 +81,7 @@
   public void testSinglePropertyMapSingleIssueActionSingleProjectAction() {
     ActionController actionController = createActionController();
 
-    ChangeEvent event = createMock(ChangeEvent.class);
+    ChangeEvent event = mock(ChangeEvent.class);
 
     Map<String, String> projectProperties = ImmutableMap.of("its-project", "itsProject");
 
@@ -94,56 +93,58 @@
 
     Set<Map<String, String>> propertySets = ImmutableSet.of(issueProperties);
 
-    expect(propertyExtractor.extractFrom(event))
-        .andReturn(new RefEventProperties(projectProperties, propertySets))
-        .anyTimes();
+    when(propertyExtractor.extractFrom(event))
+        .thenReturn(new RefEventProperties(projectProperties, propertySets));
 
-    ActionRequest issueActionRequest1 = createMock(ActionRequest.class);
+    ActionRequest issueActionRequest1 = mock(ActionRequest.class);
     Collection<ActionRequest> issueActionRequests = ImmutableList.of(issueActionRequest1);
-    expect(ruleBase.actionRequestsFor(issueProperties)).andReturn(issueActionRequests).once();
+    when(ruleBase.actionRequestsFor(issueProperties))
+        .thenReturn(issueActionRequests)
+        .thenThrow(new UnsupportedOperationException("Method called more than once"));
 
-    ActionRequest projectActionRequest1 = createMock(ActionRequest.class);
+    ActionRequest projectActionRequest1 = mock(ActionRequest.class);
     Collection<ActionRequest> projectActionRequests = ImmutableList.of(projectActionRequest1);
-    expect(ruleBase.actionRequestsFor(projectProperties)).andReturn(projectActionRequests).once();
-
-    actionExecutor.executeOnIssue(issueActionRequests, issueProperties);
-    actionExecutor.executeOnProject(projectActionRequests, projectProperties);
-
-    replayMocks();
+    when(ruleBase.actionRequestsFor(projectProperties))
+        .thenReturn(projectActionRequests)
+        .thenThrow(new UnsupportedOperationException("Method called more than once"));
 
     actionController.onEvent(event);
+
+    verify(actionExecutor).executeOnIssue(issueActionRequests, issueProperties);
+    verify(actionExecutor).executeOnProject(projectActionRequests, projectProperties);
   }
 
   public void testMultiplePropertyMapsMultipleActionMultipleIssue() {
     ActionController actionController = createActionController();
 
-    ChangeEvent event = createMock(ChangeEvent.class);
+    ChangeEvent event = mock(ChangeEvent.class);
 
     Map<String, String> properties1 = ImmutableMap.of("issue", "testIssue");
     Map<String, String> properties2 = ImmutableMap.of("issue", "testIssue2");
 
     Set<Map<String, String>> propertySets = ImmutableSet.of(properties1, properties2);
 
-    expect(propertyExtractor.extractFrom(event))
-        .andReturn(new RefEventProperties(Collections.emptyMap(), propertySets))
-        .anyTimes();
+    when(propertyExtractor.extractFrom(event))
+        .thenReturn(new RefEventProperties(Collections.emptyMap(), propertySets));
 
-    ActionRequest actionRequest1 = createMock(ActionRequest.class);
+    ActionRequest actionRequest1 = mock(ActionRequest.class);
     Collection<ActionRequest> actionRequests1 = ImmutableList.of(actionRequest1);
 
-    ActionRequest actionRequest2 = createMock(ActionRequest.class);
-    ActionRequest actionRequest3 = createMock(ActionRequest.class);
+    ActionRequest actionRequest2 = mock(ActionRequest.class);
+    ActionRequest actionRequest3 = mock(ActionRequest.class);
     Collection<ActionRequest> actionRequests2 = ImmutableList.of(actionRequest2, actionRequest3);
 
-    expect(ruleBase.actionRequestsFor(properties1)).andReturn(actionRequests1).once();
-    expect(ruleBase.actionRequestsFor(properties2)).andReturn(actionRequests2).once();
-
-    actionExecutor.executeOnIssue(actionRequests1, properties1);
-    actionExecutor.executeOnIssue(actionRequests2, properties2);
-
-    replayMocks();
+    when(ruleBase.actionRequestsFor(properties1))
+        .thenReturn(actionRequests1)
+        .thenThrow(new UnsupportedOperationException("Method called more than once"));
+    when(ruleBase.actionRequestsFor(properties2))
+        .thenReturn(actionRequests2)
+        .thenThrow(new UnsupportedOperationException("Method called more than once"));
 
     actionController.onEvent(event);
+
+    verify(actionExecutor).executeOnIssue(actionRequests1, properties1);
+    verify(actionExecutor).executeOnIssue(actionRequests2, properties2);
   }
 
   private ActionController createActionController() {
@@ -151,7 +152,7 @@
   }
 
   private void setupCommonMocks() {
-    expect(itsConfig.isEnabled(anyObject(RefEvent.class))).andReturn(true).anyTimes();
+    when(itsConfig.isEnabled(any(RefEvent.class))).thenReturn(true);
   }
 
   @Override
@@ -165,16 +166,16 @@
   private class TestModule extends FactoryModule {
     @Override
     protected void configure() {
-      propertyExtractor = createMock(PropertyExtractor.class);
+      propertyExtractor = mock(PropertyExtractor.class);
       bind(PropertyExtractor.class).toInstance(propertyExtractor);
 
-      ruleBase = createMock(RuleBase.class);
+      ruleBase = mock(RuleBase.class);
       bind(RuleBase.class).toInstance(ruleBase);
 
-      actionExecutor = createMock(ActionExecutor.class);
+      actionExecutor = mock(ActionExecutor.class);
       bind(ActionExecutor.class).toInstance(actionExecutor);
 
-      itsConfig = createMock(ItsConfig.class);
+      itsConfig = mock(ItsConfig.class);
       bind(ItsConfig.class).toInstance(itsConfig);
     }
   }
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/ActionExecutorTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/ActionExecutorTest.java
index c5e6333..5b8c43f 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/ActionExecutorTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/ActionExecutorTest.java
@@ -13,8 +13,10 @@
 // limitations under the License.
 package com.googlesource.gerrit.plugins.its.base.workflow;
 
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.expectLastCall;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
@@ -57,33 +59,30 @@
           .build();
 
   public void testExecuteItem() throws IOException {
-    ActionRequest actionRequest = createMock(ActionRequest.class);
-    expect(actionRequest.getName()).andReturn("unparsed");
-    expect(actionRequest.getUnparsed()).andReturn("unparsed action 1");
-    expect(itsFacadeFactory.getFacade(Project.nameKey(properties.get("project")))).andReturn(its);
+    ActionRequest actionRequest = mock(ActionRequest.class);
+    when(actionRequest.getName()).thenReturn("unparsed");
+    when(actionRequest.getUnparsed()).thenReturn("unparsed action 1");
+    when(itsFacadeFactory.getFacade(Project.nameKey(properties.get("project")))).thenReturn(its);
 
     Set<ActionRequest> actionRequests = ImmutableSet.of(actionRequest);
 
-    its.performAction("4711", "unparsed action 1");
-
-    replayMocks();
-
     ActionExecutor actionExecutor = createActionExecutor();
     actionExecutor.executeOnIssue(actionRequests, properties);
+
+    verify(its).performAction("4711", "unparsed action 1");
   }
 
   public void testExecuteItemException() throws IOException {
-    ActionRequest actionRequest = createMock(ActionRequest.class);
-    expect(actionRequest.getName()).andReturn("unparsed");
-    expect(actionRequest.getUnparsed()).andReturn("unparsed action 1");
-    expect(itsFacadeFactory.getFacade(Project.nameKey(properties.get("project")))).andReturn(its);
+    ActionRequest actionRequest = mock(ActionRequest.class);
+    when(actionRequest.getName()).thenReturn("unparsed");
+    when(actionRequest.getUnparsed()).thenReturn("unparsed action 1");
+    when(itsFacadeFactory.getFacade(Project.nameKey(properties.get("project")))).thenReturn(its);
 
     Set<ActionRequest> actionRequests = ImmutableSet.of(actionRequest);
 
-    its.performAction("4711", "unparsed action 1");
-    expectLastCall().andThrow(new IOException("injected exception 1"));
-
-    replayMocks();
+    doThrow(new IOException("injected exception 1"))
+        .when(its)
+        .performAction("4711", "unparsed action 1");
 
     ActionExecutor actionExecutor = createActionExecutor();
     actionExecutor.executeOnIssue(actionRequests, properties);
@@ -92,201 +91,180 @@
   }
 
   public void testExecuteIterable() throws IOException {
-    ActionRequest actionRequest1 = createMock(ActionRequest.class);
-    expect(actionRequest1.getName()).andReturn("unparsed");
-    expect(actionRequest1.getUnparsed()).andReturn("unparsed action 1");
+    ActionRequest actionRequest1 = mock(ActionRequest.class);
+    when(actionRequest1.getName()).thenReturn("unparsed");
+    when(actionRequest1.getUnparsed()).thenReturn("unparsed action 1");
 
-    ActionRequest actionRequest2 = createMock(ActionRequest.class);
-    expect(actionRequest2.getName()).andReturn("unparsed");
-    expect(actionRequest2.getUnparsed()).andReturn("unparsed action 2");
-    expect(itsFacadeFactory.getFacade(Project.nameKey(properties.get("project"))))
-        .andReturn(its)
-        .anyTimes();
+    ActionRequest actionRequest2 = mock(ActionRequest.class);
+    when(actionRequest2.getName()).thenReturn("unparsed");
+    when(actionRequest2.getUnparsed()).thenReturn("unparsed action 2");
+    when(itsFacadeFactory.getFacade(Project.nameKey(properties.get("project")))).thenReturn(its);
 
     Set<ActionRequest> actionRequests = ImmutableSet.of(actionRequest1, actionRequest2);
 
-    its.performAction("4711", "unparsed action 1");
-    its.performAction("4711", "unparsed action 2");
-
-    replayMocks();
-
     ActionExecutor actionExecutor = createActionExecutor();
     actionExecutor.executeOnIssue(actionRequests, properties);
+
+    verify(its).performAction("4711", "unparsed action 1");
+    verify(its).performAction("4711", "unparsed action 2");
   }
 
   public void testExecuteIterableExceptions() throws IOException {
-    ActionRequest actionRequest1 = createMock(ActionRequest.class);
-    expect(actionRequest1.getName()).andReturn("unparsed");
-    expect(actionRequest1.getUnparsed()).andReturn("unparsed action 1");
+    ActionRequest actionRequest1 = mock(ActionRequest.class);
+    when(actionRequest1.getName()).thenReturn("unparsed");
+    when(actionRequest1.getUnparsed()).thenReturn("unparsed action 1");
 
-    ActionRequest actionRequest2 = createMock(ActionRequest.class);
-    expect(actionRequest2.getName()).andReturn("unparsed");
-    expect(actionRequest2.getUnparsed()).andReturn("unparsed action 2");
+    ActionRequest actionRequest2 = mock(ActionRequest.class);
+    when(actionRequest2.getName()).thenReturn("unparsed");
+    when(actionRequest2.getUnparsed()).thenReturn("unparsed action 2");
 
-    ActionRequest actionRequest3 = createMock(ActionRequest.class);
-    expect(actionRequest3.getName()).andReturn("unparsed");
-    expect(actionRequest3.getUnparsed()).andReturn("unparsed action 3");
-    expect(itsFacadeFactory.getFacade(Project.nameKey(properties.get("project"))))
-        .andReturn(its)
-        .anyTimes();
+    ActionRequest actionRequest3 = mock(ActionRequest.class);
+    when(actionRequest3.getName()).thenReturn("unparsed");
+    when(actionRequest3.getUnparsed()).thenReturn("unparsed action 3");
+    when(itsFacadeFactory.getFacade(Project.nameKey(properties.get("project")))).thenReturn(its);
 
     Set<ActionRequest> actionRequests =
         ImmutableSet.of(actionRequest1, actionRequest2, actionRequest3);
 
-    its.performAction("4711", "unparsed action 1");
-    expectLastCall().andThrow(new IOException("injected exception 1"));
-    its.performAction("4711", "unparsed action 2");
-    its.performAction("4711", "unparsed action 3");
-    expectLastCall().andThrow(new IOException("injected exception 3"));
-
-    replayMocks();
+    doThrow(new IOException("injected exception 1"))
+        .when(its)
+        .performAction("4711", "unparsed action 1");
+    doThrow(new IOException("injected exception 3"))
+        .when(its)
+        .performAction("4711", "unparsed action 3");
 
     ActionExecutor actionExecutor = createActionExecutor();
     actionExecutor.executeOnIssue(actionRequests, properties);
 
     assertLogThrowableMessageContains("injected exception 1");
     assertLogThrowableMessageContains("injected exception 3");
+
+    verify(its).performAction("4711", "unparsed action 2");
   }
 
   public void testAddCommentDelegation() throws IOException {
-    ActionRequest actionRequest = createMock(ActionRequest.class);
-    expect(actionRequest.getName()).andReturn("add-comment");
+    ActionRequest actionRequest = mock(ActionRequest.class);
+    when(actionRequest.getName()).thenReturn("add-comment");
 
     Set<ActionRequest> actionRequests = ImmutableSet.of(actionRequest);
 
-    AddComment addComment = createMock(AddComment.class);
-    expect(addCommentFactory.create()).andReturn(addComment);
-    expect(itsFacadeFactory.getFacade(Project.nameKey(properties.get("project")))).andReturn(its);
-
-    addComment.execute(its, "4711", actionRequest, properties);
-
-    replayMocks();
+    AddComment addComment = mock(AddComment.class);
+    when(addCommentFactory.create()).thenReturn(addComment);
+    when(itsFacadeFactory.getFacade(Project.nameKey(properties.get("project")))).thenReturn(its);
 
     ActionExecutor actionExecutor = createActionExecutor();
     actionExecutor.executeOnIssue(actionRequests, properties);
+
+    verify(addComment).execute(its, "4711", actionRequest, properties);
   }
 
   public void testAddSoyCommentDelegation() throws IOException {
-    ActionRequest actionRequest = createMock(ActionRequest.class);
-    expect(actionRequest.getName()).andReturn("add-soy-comment");
+    ActionRequest actionRequest = mock(ActionRequest.class);
+    when(actionRequest.getName()).thenReturn("add-soy-comment");
 
     Set<ActionRequest> actionRequests = ImmutableSet.of(actionRequest);
 
-    AddSoyComment addSoyComment = createMock(AddSoyComment.class);
-    expect(addSoyCommentFactory.create()).andReturn(addSoyComment);
-    expect(itsFacadeFactory.getFacade(Project.nameKey(properties.get("project")))).andReturn(its);
-
-    addSoyComment.execute(its, "4711", actionRequest, properties);
-
-    replayMocks();
+    AddSoyComment addSoyComment = mock(AddSoyComment.class);
+    when(addSoyCommentFactory.create()).thenReturn(addSoyComment);
+    when(itsFacadeFactory.getFacade(Project.nameKey(properties.get("project")))).thenReturn(its);
 
     ActionExecutor actionExecutor = createActionExecutor();
     actionExecutor.executeOnIssue(actionRequests, properties);
+
+    verify(addSoyComment).execute(its, "4711", actionRequest, properties);
   }
 
   public void testAddStandardCommentDelegation() throws IOException {
-    ActionRequest actionRequest = createMock(ActionRequest.class);
-    expect(actionRequest.getName()).andReturn("add-standard-comment");
+    ActionRequest actionRequest = mock(ActionRequest.class);
+    when(actionRequest.getName()).thenReturn("add-standard-comment");
 
     Set<ActionRequest> actionRequests = ImmutableSet.of(actionRequest);
 
-    AddStandardComment addStandardComment = createMock(AddStandardComment.class);
-    expect(addStandardCommentFactory.create()).andReturn(addStandardComment);
-    expect(itsFacadeFactory.getFacade(Project.nameKey(properties.get("project")))).andReturn(its);
-
-    addStandardComment.execute(its, "4711", actionRequest, properties);
-
-    replayMocks();
+    AddStandardComment addStandardComment = mock(AddStandardComment.class);
+    when(addStandardCommentFactory.create()).thenReturn(addStandardComment);
+    when(itsFacadeFactory.getFacade(Project.nameKey(properties.get("project")))).thenReturn(its);
 
     ActionExecutor actionExecutor = createActionExecutor();
     actionExecutor.executeOnIssue(actionRequests, properties);
+
+    verify(addStandardComment).execute(its, "4711", actionRequest, properties);
   }
 
   public void testLogEventDelegation() throws IOException {
-    ActionRequest actionRequest = createMock(ActionRequest.class);
-    expect(actionRequest.getName()).andReturn("log-event");
+    ActionRequest actionRequest = mock(ActionRequest.class);
+    when(actionRequest.getName()).thenReturn("log-event");
 
     Set<ActionRequest> actionRequests = ImmutableSet.of(actionRequest);
 
-    LogEvent logEvent = createMock(LogEvent.class);
-    expect(logEventFactory.create()).andReturn(logEvent);
-    expect(itsFacadeFactory.getFacade(Project.nameKey(properties.get("project")))).andReturn(its);
-
-    logEvent.execute(its, "4711", actionRequest, properties);
-
-    replayMocks();
+    LogEvent logEvent = mock(LogEvent.class);
+    when(logEventFactory.create()).thenReturn(logEvent);
+    when(itsFacadeFactory.getFacade(Project.nameKey(properties.get("project")))).thenReturn(its);
 
     ActionExecutor actionExecutor = createActionExecutor();
     actionExecutor.executeOnIssue(actionRequests, properties);
+
+    verify(logEvent).execute(its, "4711", actionRequest, properties);
   }
 
   public void testCreateVersionFromPropertyDelegation() throws IOException {
-    ActionRequest actionRequest = createMock(ActionRequest.class);
-    expect(actionRequest.getName()).andReturn("create-version-from-property");
+    ActionRequest actionRequest = mock(ActionRequest.class);
+    when(actionRequest.getName()).thenReturn("create-version-from-property");
 
-    CreateVersionFromProperty createVersionFromProperty =
-        createMock(CreateVersionFromProperty.class);
-    expect(createVersionFromPropertyFactory.create()).andReturn(createVersionFromProperty);
-    expect(itsFacadeFactory.getFacade(Project.nameKey(properties.get("project")))).andReturn(its);
-
-    createVersionFromProperty.execute(its, "itsTestProject", actionRequest, projectProperties);
-
-    replayMocks();
+    CreateVersionFromProperty createVersionFromProperty = mock(CreateVersionFromProperty.class);
+    when(createVersionFromPropertyFactory.create()).thenReturn(createVersionFromProperty);
+    when(itsFacadeFactory.getFacade(Project.nameKey(properties.get("project")))).thenReturn(its);
 
     ActionExecutor actionExecutor = createActionExecutor();
     actionExecutor.executeOnProject(Collections.singleton(actionRequest), projectProperties);
+
+    verify(createVersionFromProperty)
+        .execute(its, "itsTestProject", actionRequest, projectProperties);
   }
 
   public void testAddPropertyToFieldDelegation() throws IOException {
-    ActionRequest actionRequest = createMock(ActionRequest.class);
-    expect(actionRequest.getName()).andReturn("add-property-to-field");
+    ActionRequest actionRequest = mock(ActionRequest.class);
+    when(actionRequest.getName()).thenReturn("add-property-to-field");
 
     Set<ActionRequest> actionRequests = ImmutableSet.of(actionRequest);
 
-    AddPropertyToField addPropertyToField = createMock(AddPropertyToField.class);
-    expect(addPropertyToFieldFactory.create()).andReturn(addPropertyToField);
-    expect(itsFacadeFactory.getFacade(Project.nameKey(properties.get("project")))).andReturn(its);
-
-    addPropertyToField.execute(its, "4711", actionRequest, properties);
-
-    replayMocks();
+    AddPropertyToField addPropertyToField = mock(AddPropertyToField.class);
+    when(addPropertyToFieldFactory.create()).thenReturn(addPropertyToField);
+    when(itsFacadeFactory.getFacade(Project.nameKey(properties.get("project")))).thenReturn(its);
 
     ActionExecutor actionExecutor = createActionExecutor();
     actionExecutor.executeOnIssue(actionRequests, properties);
+
+    verify(addPropertyToField).execute(its, "4711", actionRequest, properties);
   }
 
   public void testExecuteIssueCustomAction() throws IOException {
-    expect(customAction.getType()).andReturn(ActionType.ISSUE);
+    when(customAction.getType()).thenReturn(ActionType.ISSUE);
 
-    ActionRequest actionRequest = createMock(ActionRequest.class);
-    expect(actionRequest.getName()).andReturn(CUSTOM_ACTION_NAME);
-    expect(itsFacadeFactory.getFacade(Project.nameKey(properties.get("project")))).andReturn(its);
+    ActionRequest actionRequest = mock(ActionRequest.class);
+    when(actionRequest.getName()).thenReturn(CUSTOM_ACTION_NAME);
+    when(itsFacadeFactory.getFacade(Project.nameKey(properties.get("project")))).thenReturn(its);
 
     Set<ActionRequest> actionRequests = ImmutableSet.of(actionRequest);
 
-    customAction.execute(its, "4711", actionRequest, properties);
-
-    replayMocks();
-
     ActionExecutor actionExecutor = createActionExecutor();
     actionExecutor.executeOnIssue(actionRequests, properties);
+
+    verify(customAction).execute(its, "4711", actionRequest, properties);
   }
 
   public void testExecuteProjectCustomAction() throws IOException {
-    expect(customAction.getType()).andReturn(ActionType.PROJECT);
+    when(customAction.getType()).thenReturn(ActionType.PROJECT);
 
-    ActionRequest actionRequest = createMock(ActionRequest.class);
-    expect(actionRequest.getName()).andReturn(CUSTOM_ACTION_NAME);
-    expect(itsFacadeFactory.getFacade(Project.nameKey(properties.get("project")))).andReturn(its);
+    ActionRequest actionRequest = mock(ActionRequest.class);
+    when(actionRequest.getName()).thenReturn(CUSTOM_ACTION_NAME);
+    when(itsFacadeFactory.getFacade(Project.nameKey(properties.get("project")))).thenReturn(its);
 
     Set<ActionRequest> actionRequests = ImmutableSet.of(actionRequest);
 
-    customAction.execute(its, "itsTestProject", actionRequest, projectProperties);
-
-    replayMocks();
-
     ActionExecutor actionExecutor = createActionExecutor();
     actionExecutor.executeOnProject(actionRequests, projectProperties);
+
+    verify(customAction).execute(its, "itsTestProject", actionRequest, projectProperties);
   }
 
   private ActionExecutor createActionExecutor() {
@@ -302,32 +280,32 @@
   private class TestModule extends FactoryModule {
     @Override
     protected void configure() {
-      its = createMock(ItsFacade.class);
+      its = mock(ItsFacade.class);
       bind(ItsFacade.class).toInstance(its);
 
-      addCommentFactory = createMock(AddComment.Factory.class);
+      addCommentFactory = mock(AddComment.Factory.class);
       bind(AddComment.Factory.class).toInstance(addCommentFactory);
 
-      addSoyCommentFactory = createMock(AddSoyComment.Factory.class);
+      addSoyCommentFactory = mock(AddSoyComment.Factory.class);
       bind(AddSoyComment.Factory.class).toInstance(addSoyCommentFactory);
 
-      addStandardCommentFactory = createMock(AddStandardComment.Factory.class);
+      addStandardCommentFactory = mock(AddStandardComment.Factory.class);
       bind(AddStandardComment.Factory.class).toInstance(addStandardCommentFactory);
 
-      logEventFactory = createMock(LogEvent.Factory.class);
+      logEventFactory = mock(LogEvent.Factory.class);
       bind(LogEvent.Factory.class).toInstance(logEventFactory);
 
-      itsFacadeFactory = createMock(ItsFacadeFactory.class);
+      itsFacadeFactory = mock(ItsFacadeFactory.class);
       bind(ItsFacadeFactory.class).toInstance(itsFacadeFactory);
 
-      addPropertyToFieldFactory = createMock(AddPropertyToField.Factory.class);
+      addPropertyToFieldFactory = mock(AddPropertyToField.Factory.class);
       bind(AddPropertyToField.Factory.class).toInstance(addPropertyToFieldFactory);
 
-      createVersionFromPropertyFactory = createMock(CreateVersionFromProperty.Factory.class);
+      createVersionFromPropertyFactory = mock(CreateVersionFromProperty.Factory.class);
       bind(CreateVersionFromProperty.Factory.class).toInstance(createVersionFromPropertyFactory);
 
       DynamicMap.mapOf(binder(), CustomAction.class);
-      customAction = createMock(CustomAction.class);
+      customAction = mock(CustomAction.class);
 
       bind(CustomAction.class)
           .annotatedWith(Exports.named(CUSTOM_ACTION_NAME))
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/ActionRequestTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/ActionRequestTest.java
index e6de999..ac927f4 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/ActionRequestTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/ActionRequestTest.java
@@ -23,135 +23,97 @@
   private Injector injector;
 
   public void testUnparsedParameterless() {
-    replayMocks();
-
     ActionRequest actionRequest = createActionRequest("action");
     assertEquals("Unparsed string does not match", "action", actionRequest.getUnparsed());
   }
 
   public void testUnparsedNull() {
-    replayMocks();
-
     ActionRequest actionRequest = createActionRequest(null);
     assertEquals("Unparsed string does not match", "", actionRequest.getUnparsed());
   }
 
   public void testUnparsedSingleParameter() {
-    replayMocks();
-
     ActionRequest actionRequest = createActionRequest("action param");
     assertEquals("Unparsed string does not match", "action param", actionRequest.getUnparsed());
   }
 
   public void testUnparsedMultipleParameters() {
-    replayMocks();
-
     ActionRequest actionRequest = createActionRequest("action param1 param2");
     assertEquals(
         "Unparsed string does not match", "action param1 param2", actionRequest.getUnparsed());
   }
 
   public void testNameParameterless() {
-    replayMocks();
-
     ActionRequest actionRequest = createActionRequest("action");
     assertEquals("Unparsed string does not match", "action", actionRequest.getName());
   }
 
   public void testNameSingleParameter() {
-    replayMocks();
-
     ActionRequest actionRequest = createActionRequest("action param");
     assertEquals("Unparsed string does not match", "action", actionRequest.getName());
   }
 
   public void testNameMultipleParameters() {
-    replayMocks();
-
     ActionRequest actionRequest = createActionRequest("action param1 param2");
     assertEquals("Unparsed string does not match", "action", actionRequest.getName());
   }
 
   public void testNameNull() {
-    replayMocks();
-
     ActionRequest actionRequest = createActionRequest(null);
     assertEquals("Unparsed string does not match", "", actionRequest.getName());
   }
 
   public void testParameter1Parameterless() {
-    replayMocks();
-
     ActionRequest actionRequest = createActionRequest("action");
     assertEquals("Unparsed string does not match", "", actionRequest.getParameter(1));
   }
 
   public void testParameter1Null() {
-    replayMocks();
-
     ActionRequest actionRequest = createActionRequest(null);
     assertEquals("Unparsed string does not match", "", actionRequest.getParameter(1));
   }
 
   public void testParameter1SingleParameter() {
-    replayMocks();
-
     ActionRequest actionRequest = createActionRequest("action param");
     assertEquals("Unparsed string does not match", "param", actionRequest.getParameter(1));
   }
 
   public void testParemeter1MultipleParameters() {
-    replayMocks();
-
     ActionRequest actionRequest = createActionRequest("action param1 param2");
     assertEquals("Unparsed string does not match", "param1", actionRequest.getParameter(1));
   }
 
   public void testParameter3Parameterless() {
-    replayMocks();
-
     ActionRequest actionRequest = createActionRequest("action");
     assertEquals("Unparsed string does not match", "", actionRequest.getParameter(3));
   }
 
   public void testParameter3Null() {
-    replayMocks();
-
     ActionRequest actionRequest = createActionRequest(null);
     assertEquals("Unparsed string does not match", "", actionRequest.getParameter(3));
   }
 
   public void testParameter3SingleParameter() {
-    replayMocks();
-
     ActionRequest actionRequest = createActionRequest("action param");
     assertEquals("Unparsed string does not match", "", actionRequest.getParameter(3));
   }
 
   public void testParemeter3With2Parameters() {
-    replayMocks();
-
     ActionRequest actionRequest = createActionRequest("action param1 param2");
     assertEquals("Unparsed string does not match", "", actionRequest.getParameter(3));
   }
 
   public void testParemeter3With3Parameters() {
-    replayMocks();
-
     ActionRequest actionRequest = createActionRequest("action param1 param2 " + "param3");
     assertEquals("Unparsed string does not match", "param3", actionRequest.getParameter(3));
   }
 
   public void testParemeter3With4Parameters() {
-    replayMocks();
-
     ActionRequest actionRequest = createActionRequest("action param1 param2 " + "param3 param4");
     assertEquals("Unparsed string does not match", "param3", actionRequest.getParameter(3));
   }
 
   public void testParametersParameterless() {
-    replayMocks();
-
     ActionRequest actionRequest = createActionRequest("action");
 
     String[] expected = new String[0];
@@ -162,8 +124,6 @@
   }
 
   public void testParametersNull() {
-    replayMocks();
-
     ActionRequest actionRequest = createActionRequest(null);
 
     String[] expected = new String[0];
@@ -174,8 +134,6 @@
   }
 
   public void testParametersSingleParameter() {
-    replayMocks();
-
     ActionRequest actionRequest = createActionRequest("action param");
 
     String[] expected = new String[] {"param"};
@@ -186,8 +144,6 @@
   }
 
   public void testParameters3Parameter() {
-    replayMocks();
-
     ActionRequest actionRequest = createActionRequest("action param1 param2 " + "param3");
 
     String[] expected = new String[] {"param1", "param2", "param3"};
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/AddCommentTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/AddCommentTest.java
index 149dfca..87fc762 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/AddCommentTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/AddCommentTest.java
@@ -13,7 +13,9 @@
 // limitations under the License.
 package com.googlesource.gerrit.plugins.its.base.workflow;
 
-import static org.easymock.EasyMock.expect;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 import com.google.common.collect.ImmutableMap;
 import com.google.gerrit.extensions.config.FactoryModule;
@@ -29,25 +31,21 @@
   private ItsFacade its;
 
   public void testEmpty() throws IOException {
-    ActionRequest actionRequest = createMock(ActionRequest.class);
-    expect(actionRequest.getParameters()).andReturn(new String[] {});
-
-    replayMocks();
+    ActionRequest actionRequest = mock(ActionRequest.class);
+    when(actionRequest.getParameters()).thenReturn(new String[] {});
 
     AddComment addComment = createAddComment();
     addComment.execute(null, "4711", actionRequest, ImmutableMap.of());
   }
 
   public void testPlain() throws IOException {
-    ActionRequest actionRequest = createMock(ActionRequest.class);
-    expect(actionRequest.getParameters()).andReturn(new String[] {"Some", "test", "comment"});
-
-    its.addComment("4711", "Some test comment");
-
-    replayMocks();
+    ActionRequest actionRequest = mock(ActionRequest.class);
+    when(actionRequest.getParameters()).thenReturn(new String[] {"Some", "test", "comment"});
 
     AddComment addComment = createAddComment();
     addComment.execute(its, "4711", actionRequest, ImmutableMap.of());
+
+    verify(its).addComment("4711", "Some test comment");
   }
 
   private AddComment createAddComment() {
@@ -63,7 +61,7 @@
   private class TestModule extends FactoryModule {
     @Override
     protected void configure() {
-      its = createMock(ItsFacade.class);
+      its = mock(ItsFacade.class);
       bind(ItsFacade.class).toInstance(its);
     }
   }
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/AddPropertyToFieldParametersExtractorTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/AddPropertyToFieldParametersExtractorTest.java
index b95f5ef..a760936 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/AddPropertyToFieldParametersExtractorTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/AddPropertyToFieldParametersExtractorTest.java
@@ -15,16 +15,17 @@
 package com.googlesource.gerrit.plugins.its.base.workflow;
 
 import static com.google.common.truth.Truth8.assertThat;
-import static org.easymock.EasyMock.expect;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 import com.google.gerrit.extensions.config.FactoryModule;
 import com.google.inject.Guice;
 import com.google.inject.Injector;
-import com.googlesource.gerrit.plugins.its.base.testutil.MockingTestCase;
 import java.util.Collections;
 import java.util.Optional;
+import junit.framework.TestCase;
 
-public class AddPropertyToFieldParametersExtractorTest extends MockingTestCase {
+public class AddPropertyToFieldParametersExtractorTest extends TestCase {
 
   private static final String FIELD_ID = "fieldId";
   private static final String PROPERTY_ID = "propertyId";
@@ -54,46 +55,36 @@
   }
 
   private void testWrongNumberOfReceivedParameters(String[] parameters) {
-    ActionRequest actionRequest = createMock(ActionRequest.class);
-    expect(actionRequest.getParameters()).andReturn(parameters);
-
-    replayMocks();
+    ActionRequest actionRequest = mock(ActionRequest.class);
+    when(actionRequest.getParameters()).thenReturn(parameters);
 
     assertFalse(extractor.extract(actionRequest, Collections.emptyMap()).isPresent());
   }
 
   public void testBlankFieldId() {
-    ActionRequest actionRequest = createMock(ActionRequest.class);
-    expect(actionRequest.getParameters()).andReturn(new String[] {PROPERTY_ID, ""});
-
-    replayMocks();
+    ActionRequest actionRequest = mock(ActionRequest.class);
+    when(actionRequest.getParameters()).thenReturn(new String[] {PROPERTY_ID, ""});
 
     assertFalse(extractor.extract(actionRequest, Collections.emptyMap()).isPresent());
   }
 
   public void testBlankPropertyId() {
-    ActionRequest actionRequest = createMock(ActionRequest.class);
-    expect(actionRequest.getParameters()).andReturn(new String[] {"", FIELD_ID});
-
-    replayMocks();
+    ActionRequest actionRequest = mock(ActionRequest.class);
+    when(actionRequest.getParameters()).thenReturn(new String[] {"", FIELD_ID});
 
     assertFalse(extractor.extract(actionRequest, Collections.emptyMap()).isPresent());
   }
 
   public void testUnknownPropertyId() {
-    ActionRequest actionRequest = createMock(ActionRequest.class);
-    expect(actionRequest.getParameters()).andReturn(new String[] {FIELD_ID, PROPERTY_ID});
-
-    replayMocks();
+    ActionRequest actionRequest = mock(ActionRequest.class);
+    when(actionRequest.getParameters()).thenReturn(new String[] {FIELD_ID, PROPERTY_ID});
 
     assertFalse(extractor.extract(actionRequest, Collections.emptyMap()).isPresent());
   }
 
   public void testHappyPath() {
-    ActionRequest actionRequest = createMock(ActionRequest.class);
-    expect(actionRequest.getParameters()).andReturn(new String[] {PROPERTY_ID, FIELD_ID});
-
-    replayMocks();
+    ActionRequest actionRequest = mock(ActionRequest.class);
+    when(actionRequest.getParameters()).thenReturn(new String[] {PROPERTY_ID, FIELD_ID});
 
     Optional<AddPropertyToFieldParameters> extractedParameters =
         extractor.extract(actionRequest, Collections.singletonMap(PROPERTY_ID, PROPERTY_VALUE));
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/AddPropertyToFieldTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/AddPropertyToFieldTest.java
index a601b04..0f05875 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/AddPropertyToFieldTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/AddPropertyToFieldTest.java
@@ -14,20 +14,21 @@
 
 package com.googlesource.gerrit.plugins.its.base.workflow;
 
-import static org.easymock.EasyMock.expect;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 import com.google.gerrit.extensions.config.FactoryModule;
 import com.google.inject.Guice;
 import com.google.inject.Injector;
 import com.googlesource.gerrit.plugins.its.base.its.ItsFacade;
-import com.googlesource.gerrit.plugins.its.base.testutil.MockingTestCase;
 import java.io.IOException;
 import java.util.Collections;
 import java.util.Map;
 import java.util.Optional;
-import org.easymock.EasyMock;
+import junit.framework.TestCase;
 
-public class AddPropertyToFieldTest extends MockingTestCase {
+public class AddPropertyToFieldTest extends TestCase {
 
   private static final String ISSUE_ID = "4711";
   private static final String FIELD_ID = "fieldId";
@@ -47,28 +48,25 @@
   private class TestModule extends FactoryModule {
     @Override
     protected void configure() {
-      parametersExtractor = createMock(AddPropertyToFieldParametersExtractor.class);
+      parametersExtractor = mock(AddPropertyToFieldParametersExtractor.class);
       bind(AddPropertyToFieldParametersExtractor.class).toInstance(parametersExtractor);
 
-      its = createMock(ItsFacade.class);
+      its = mock(ItsFacade.class);
       bind(ItsFacade.class).toInstance(its);
     }
   }
 
   public void testHappyPath() throws IOException {
-    ActionRequest actionRequest = createMock(ActionRequest.class);
+    ActionRequest actionRequest = mock(ActionRequest.class);
 
     Map<String, String> properties = Collections.singletonMap(PROPERTY_ID, PROPERTY_VALUE);
-    expect(parametersExtractor.extract(actionRequest, properties))
-        .andReturn(Optional.of(new AddPropertyToFieldParameters(PROPERTY_VALUE, FIELD_ID)));
-
-    its.addValueToField(ISSUE_ID, PROPERTY_VALUE, FIELD_ID);
-    EasyMock.expectLastCall().once();
-
-    replayMocks();
+    when(parametersExtractor.extract(actionRequest, properties))
+        .thenReturn(Optional.of(new AddPropertyToFieldParameters(PROPERTY_VALUE, FIELD_ID)));
 
     AddPropertyToField addPropertyToField = createAddPropertyToField();
     addPropertyToField.execute(its, ISSUE_ID, actionRequest, properties);
+
+    verify(its).addValueToField(ISSUE_ID, PROPERTY_VALUE, FIELD_ID);
   }
 
   private AddPropertyToField createAddPropertyToField() {
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/AddStandardCommentTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/AddStandardCommentTest.java
index d695bd1..ab11820 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/AddStandardCommentTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/AddStandardCommentTest.java
@@ -13,6 +13,9 @@
 // limitations under the License.
 package com.googlesource.gerrit.plugins.its.base.workflow;
 
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+
 import com.google.common.collect.ImmutableMap;
 import com.google.gerrit.extensions.config.FactoryModule;
 import com.google.inject.Guice;
@@ -28,19 +31,18 @@
   private ItsFacade its;
 
   public void testChangeMergedPlain() throws IOException {
-    ActionRequest actionRequest = createMock(ActionRequest.class);
+    ActionRequest actionRequest = mock(ActionRequest.class);
 
     Map<String, String> properties = ImmutableMap.of("event-type", "change-merged");
 
-    its.addComment("42", "Change merged");
-    replayMocks();
-
     StandardAction action = injector.getInstance(AddStandardComment.class);
     action.execute(its, "42", actionRequest, properties);
+
+    verify(its).addComment("42", "Change merged");
   }
 
   public void testChangeMergedFull() throws IOException {
-    ActionRequest actionRequest = createMock(ActionRequest.class);
+    ActionRequest actionRequest = mock(ActionRequest.class);
 
     Map<String, String> properties =
         ImmutableMap.<String, String>builder()
@@ -51,32 +53,31 @@
             .put("formatChangeUrl", "HtTp://ExAmPlE.OrG/ChAnGe")
             .build();
 
-    its.addComment(
-        "176",
-        "Change 4711 merged by John Doe:\n"
-            + "Test-Change-Subject\n"
-            + "\n"
-            + "HtTp://ExAmPlE.OrG/ChAnGe");
-    replayMocks();
-
     StandardAction action = injector.getInstance(AddStandardComment.class);
     action.execute(its, "176", actionRequest, properties);
+
+    verify(its)
+        .addComment(
+            "176",
+            "Change 4711 merged by John Doe:\n"
+                + "Test-Change-Subject\n"
+                + "\n"
+                + "HtTp://ExAmPlE.OrG/ChAnGe");
   }
 
   public void testChangeAbandonedPlain() throws IOException {
-    ActionRequest actionRequest = createMock(ActionRequest.class);
+    ActionRequest actionRequest = mock(ActionRequest.class);
 
     Map<String, String> properties = ImmutableMap.of("event-type", "change-abandoned");
 
-    its.addComment("42", "Change abandoned");
-    replayMocks();
-
     StandardAction action = injector.getInstance(AddStandardComment.class);
     action.execute(its, "42", actionRequest, properties);
+
+    verify(its).addComment("42", "Change abandoned");
   }
 
   public void testChangeAbandonedFull() throws IOException {
-    ActionRequest actionRequest = createMock(ActionRequest.class);
+    ActionRequest actionRequest = mock(ActionRequest.class);
 
     Map<String, String> properties =
         ImmutableMap.<String, String>builder()
@@ -88,35 +89,34 @@
             .put("formatChangeUrl", "HtTp://ExAmPlE.OrG/ChAnGe")
             .build();
 
-    its.addComment(
-        "176",
-        "Change 4711 abandoned by John Doe:\n"
-            + "Test-Change-Subject\n"
-            + "\n"
-            + "Reason:\n"
-            + "Test-Reason\n"
-            + "\n"
-            + "HtTp://ExAmPlE.OrG/ChAnGe");
-    replayMocks();
-
     StandardAction action = injector.getInstance(AddStandardComment.class);
     action.execute(its, "176", actionRequest, properties);
+
+    verify(its)
+        .addComment(
+            "176",
+            "Change 4711 abandoned by John Doe:\n"
+                + "Test-Change-Subject\n"
+                + "\n"
+                + "Reason:\n"
+                + "Test-Reason\n"
+                + "\n"
+                + "HtTp://ExAmPlE.OrG/ChAnGe");
   }
 
   public void testChangeRestoredPlain() throws IOException {
-    ActionRequest actionRequest = createMock(ActionRequest.class);
+    ActionRequest actionRequest = mock(ActionRequest.class);
 
     Map<String, String> properties = ImmutableMap.of("event-type", "change-restored");
 
-    its.addComment("42", "Change restored");
-    replayMocks();
-
     StandardAction action = injector.getInstance(AddStandardComment.class);
     action.execute(its, "42", actionRequest, properties);
+
+    verify(its).addComment("42", "Change restored");
   }
 
   public void testChangeRestoredFull() throws IOException {
-    ActionRequest actionRequest = createMock(ActionRequest.class);
+    ActionRequest actionRequest = mock(ActionRequest.class);
 
     Map<String, String> properties =
         ImmutableMap.<String, String>builder()
@@ -128,35 +128,34 @@
             .put("formatChangeUrl", "HtTp://ExAmPlE.OrG/ChAnGe")
             .build();
 
-    its.addComment(
-        "176",
-        "Change 4711 restored by John Doe:\n"
-            + "Test-Change-Subject\n"
-            + "\n"
-            + "Reason:\n"
-            + "Test-Reason\n"
-            + "\n"
-            + "HtTp://ExAmPlE.OrG/ChAnGe");
-    replayMocks();
-
     StandardAction action = injector.getInstance(AddStandardComment.class);
     action.execute(its, "176", actionRequest, properties);
+
+    verify(its)
+        .addComment(
+            "176",
+            "Change 4711 restored by John Doe:\n"
+                + "Test-Change-Subject\n"
+                + "\n"
+                + "Reason:\n"
+                + "Test-Reason\n"
+                + "\n"
+                + "HtTp://ExAmPlE.OrG/ChAnGe");
   }
 
   public void testPatchSetCreatedPlain() throws IOException {
-    ActionRequest actionRequest = createMock(ActionRequest.class);
+    ActionRequest actionRequest = mock(ActionRequest.class);
 
     Map<String, String> properties = ImmutableMap.of("event-type", "patchset-created");
 
-    its.addComment("42", "Change had a related patch set uploaded");
-    replayMocks();
-
     StandardAction action = injector.getInstance(AddStandardComment.class);
     action.execute(its, "42", actionRequest, properties);
+
+    verify(its).addComment("42", "Change had a related patch set uploaded");
   }
 
   public void testPatchSetCreatedFull() throws IOException {
-    ActionRequest actionRequest = createMock(ActionRequest.class);
+    ActionRequest actionRequest = mock(ActionRequest.class);
 
     Map<String, String> properties =
         ImmutableMap.<String, String>builder()
@@ -167,17 +166,17 @@
             .put("formatChangeUrl", "HtTp://ExAmPlE.OrG/ChAnGe")
             .build();
 
-    its.addComment(
-        "176",
-        "Change 4711 had a related patch set uploaded by "
-            + "John Doe:\n"
-            + "Test-Change-Subject\n"
-            + "\n"
-            + "HtTp://ExAmPlE.OrG/ChAnGe");
-    replayMocks();
-
     StandardAction action = injector.getInstance(AddStandardComment.class);
     action.execute(its, "176", actionRequest, properties);
+
+    verify(its)
+        .addComment(
+            "176",
+            "Change 4711 had a related patch set uploaded by "
+                + "John Doe:\n"
+                + "Test-Change-Subject\n"
+                + "\n"
+                + "HtTp://ExAmPlE.OrG/ChAnGe");
   }
 
   @Override
@@ -190,7 +189,7 @@
   private class TestModule extends FactoryModule {
     @Override
     protected void configure() {
-      its = createMock(ItsFacade.class);
+      its = mock(ItsFacade.class);
       bind(ItsFacade.class).toInstance(its);
     }
   }
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/ConditionTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/ConditionTest.java
index 3df38cc..b31b3e2 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/ConditionTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/ConditionTest.java
@@ -33,8 +33,6 @@
 
     Map<String, String> properties = ImmutableMap.of("testKey", "testValue");
 
-    replayMocks();
-
     assertTrue("isMetBy gave false", condition.isMetBy(properties));
   }
 
@@ -43,8 +41,6 @@
 
     Map<String, String> properties = ImmutableMap.of();
 
-    replayMocks();
-
     assertFalse("isMetBy gave true", condition.isMetBy(properties));
   }
 
@@ -53,8 +49,6 @@
 
     Map<String, String> properties = ImmutableMap.of("otherKey", "testValue");
 
-    replayMocks();
-
     assertFalse("isMetBy gave true", condition.isMetBy(properties));
   }
 
@@ -63,8 +57,6 @@
 
     Map<String, String> properties = ImmutableMap.of("testKey", "otherValue");
 
-    replayMocks();
-
     assertFalse("isMetBy gave true", condition.isMetBy(properties));
   }
 
@@ -73,8 +65,6 @@
 
     Map<String, String> properties = ImmutableMap.of("testKey", "value2");
 
-    replayMocks();
-
     assertTrue("isMetBy gave false", condition.isMetBy(properties));
   }
 
@@ -83,8 +73,6 @@
 
     Map<String, String> properties = ImmutableMap.of("testKey", "value1 value3");
 
-    replayMocks();
-
     assertTrue("isMetBy gave false", condition.isMetBy(properties));
   }
 
@@ -93,8 +81,6 @@
 
     Map<String, String> properties = ImmutableMap.of("testKey", "value1 value3");
 
-    replayMocks();
-
     assertTrue("isMetBy gave false", condition.isMetBy(properties));
   }
 
@@ -103,8 +89,6 @@
 
     Map<String, String> properties = ImmutableMap.of("testKey", "value1 value2 value3");
 
-    replayMocks();
-
     assertTrue("isMetBy gave false", condition.isMetBy(properties));
   }
 
@@ -113,8 +97,6 @@
 
     Map<String, String> properties = ImmutableMap.of("testKey", "otherValue1 value2 otherValue3");
 
-    replayMocks();
-
     assertTrue("isMetBy gave false", condition.isMetBy(properties));
   }
 
@@ -123,8 +105,6 @@
 
     Map<String, String> properties = ImmutableMap.of();
 
-    replayMocks();
-
     assertTrue("isMetBy gave false", condition.isMetBy(properties));
   }
 
@@ -133,8 +113,6 @@
 
     Map<String, String> properties = ImmutableMap.of("otherKey", "testValue");
 
-    replayMocks();
-
     assertTrue("isMetBy gave false", condition.isMetBy(properties));
   }
 
@@ -143,8 +121,6 @@
 
     Map<String, String> properties = ImmutableMap.of("testKey", "otherValue");
 
-    replayMocks();
-
     assertTrue("isMetBy gave false", condition.isMetBy(properties));
   }
 
@@ -153,8 +129,6 @@
 
     Map<String, String> properties = ImmutableMap.of("testKey", "otherValue");
 
-    replayMocks();
-
     assertTrue("isMetBy gave false", condition.isMetBy(properties));
   }
 
@@ -163,8 +137,6 @@
 
     Map<String, String> properties = ImmutableMap.of("testKey", "value1");
 
-    replayMocks();
-
     assertFalse("isMetBy gave true", condition.isMetBy(properties));
   }
 
@@ -173,8 +145,6 @@
 
     Map<String, String> properties = ImmutableMap.of("testKey", "value1 value3");
 
-    replayMocks();
-
     assertFalse("isMetBy gave true", condition.isMetBy(properties));
   }
 
@@ -183,8 +153,6 @@
 
     Map<String, String> properties = ImmutableMap.of("testKey", "value1 value2 value3");
 
-    replayMocks();
-
     assertFalse("isMetBy gave true", condition.isMetBy(properties));
   }
 
@@ -192,7 +160,6 @@
     Condition condition = createCondition("testKey", "!,value1,value2,value3");
 
     Map<String, String> properties = ImmutableMap.of("testKey", "otherValue1 value2 otherValue3");
-    replayMocks();
 
     assertFalse("isMetBy gave true", condition.isMetBy(properties));
   }
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/CreateVersionFromPropertyParametersExtractorTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/CreateVersionFromPropertyParametersExtractorTest.java
index d153109..881fd6c 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/CreateVersionFromPropertyParametersExtractorTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/CreateVersionFromPropertyParametersExtractorTest.java
@@ -1,16 +1,17 @@
 package com.googlesource.gerrit.plugins.its.base.workflow;
 
 import static com.google.common.truth.Truth8.assertThat;
-import static org.easymock.EasyMock.expect;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 import com.google.gerrit.extensions.config.FactoryModule;
 import com.google.inject.Guice;
 import com.google.inject.Injector;
-import com.googlesource.gerrit.plugins.its.base.testutil.MockingTestCase;
 import java.util.Collections;
 import java.util.Optional;
+import junit.framework.TestCase;
 
-public class CreateVersionFromPropertyParametersExtractorTest extends MockingTestCase {
+public class CreateVersionFromPropertyParametersExtractorTest extends TestCase {
 
   private static final String PROPERTY_ID = "propertyId";
   private static final String PROPERTY_VALUE = "propertyValue";
@@ -35,10 +36,8 @@
   }
 
   private void testWrongNumberOfReceivedParameters(String[] parameters) {
-    ActionRequest actionRequest = createMock(ActionRequest.class);
-    expect(actionRequest.getParameters()).andReturn(parameters);
-
-    replayMocks();
+    ActionRequest actionRequest = mock(ActionRequest.class);
+    when(actionRequest.getParameters()).thenReturn(parameters);
 
     Optional<CreateVersionFromPropertyParameters> extractedParameters =
         extractor.extract(actionRequest, Collections.emptyMap());
@@ -46,10 +45,8 @@
   }
 
   public void testBlankPropertyId() {
-    ActionRequest actionRequest = createMock(ActionRequest.class);
-    expect(actionRequest.getParameters()).andReturn(new String[] {""});
-
-    replayMocks();
+    ActionRequest actionRequest = mock(ActionRequest.class);
+    when(actionRequest.getParameters()).thenReturn(new String[] {""});
 
     Optional<CreateVersionFromPropertyParameters> extractedParameters =
         extractor.extract(actionRequest, Collections.emptyMap());
@@ -57,10 +54,8 @@
   }
 
   public void testUnknownPropertyId() {
-    ActionRequest actionRequest = createMock(ActionRequest.class);
-    expect(actionRequest.getParameters()).andReturn(new String[] {PROPERTY_ID});
-
-    replayMocks();
+    ActionRequest actionRequest = mock(ActionRequest.class);
+    when(actionRequest.getParameters()).thenReturn(new String[] {PROPERTY_ID});
 
     Optional<CreateVersionFromPropertyParameters> extractedParameters =
         extractor.extract(actionRequest, Collections.emptyMap());
@@ -68,10 +63,8 @@
   }
 
   public void testHappyPath() {
-    ActionRequest actionRequest = createMock(ActionRequest.class);
-    expect(actionRequest.getParameters()).andReturn(new String[] {PROPERTY_ID});
-
-    replayMocks();
+    ActionRequest actionRequest = mock(ActionRequest.class);
+    when(actionRequest.getParameters()).thenReturn(new String[] {PROPERTY_ID});
 
     Optional<CreateVersionFromPropertyParameters> extractedParameters =
         extractor.extract(actionRequest, Collections.singletonMap(PROPERTY_ID, PROPERTY_VALUE));
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/CreateVersionFromPropertyTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/CreateVersionFromPropertyTest.java
index 19735be..7f3e2e0 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/CreateVersionFromPropertyTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/CreateVersionFromPropertyTest.java
@@ -14,20 +14,21 @@
 
 package com.googlesource.gerrit.plugins.its.base.workflow;
 
-import static org.easymock.EasyMock.expect;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 import com.google.gerrit.extensions.config.FactoryModule;
 import com.google.inject.Guice;
 import com.google.inject.Injector;
 import com.googlesource.gerrit.plugins.its.base.its.ItsFacade;
-import com.googlesource.gerrit.plugins.its.base.testutil.MockingTestCase;
 import java.io.IOException;
 import java.util.Collections;
 import java.util.Map;
 import java.util.Optional;
-import org.easymock.EasyMock;
+import junit.framework.TestCase;
 
-public class CreateVersionFromPropertyTest extends MockingTestCase {
+public class CreateVersionFromPropertyTest extends TestCase {
 
   private static final String ITS_PROJECT = "test-project";
   private static final String PROPERTY_VALUE = "propertyValue";
@@ -45,28 +46,25 @@
   private class TestModule extends FactoryModule {
     @Override
     protected void configure() {
-      its = createMock(ItsFacade.class);
+      its = mock(ItsFacade.class);
       bind(ItsFacade.class).toInstance(its);
 
-      parametersExtractor = createMock(CreateVersionFromPropertyParametersExtractor.class);
+      parametersExtractor = mock(CreateVersionFromPropertyParametersExtractor.class);
       bind(CreateVersionFromPropertyParametersExtractor.class).toInstance(parametersExtractor);
     }
   }
 
   public void testHappyPath() throws IOException {
-    ActionRequest actionRequest = createMock(ActionRequest.class);
+    ActionRequest actionRequest = mock(ActionRequest.class);
 
     Map<String, String> properties = Collections.emptyMap();
-    expect(parametersExtractor.extract(actionRequest, properties))
-        .andReturn(Optional.of(new CreateVersionFromPropertyParameters(PROPERTY_VALUE)));
-
-    its.createVersion(ITS_PROJECT, PROPERTY_VALUE);
-    EasyMock.expectLastCall().once();
-
-    replayMocks();
+    when(parametersExtractor.extract(actionRequest, properties))
+        .thenReturn(Optional.of(new CreateVersionFromPropertyParameters(PROPERTY_VALUE)));
 
     CreateVersionFromProperty createVersionFromProperty = createCreateVersionFromProperty();
     createVersionFromProperty.execute(its, ITS_PROJECT, actionRequest, properties);
+
+    verify(its).createVersion(ITS_PROJECT, PROPERTY_VALUE);
   }
 
   private CreateVersionFromProperty createCreateVersionFromProperty() {
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/ItsRulesProjectCacheTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/ItsRulesProjectCacheTest.java
index 2da7258..6b83097 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/ItsRulesProjectCacheTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/ItsRulesProjectCacheTest.java
@@ -16,8 +16,9 @@
 
 import static com.googlesource.gerrit.plugins.its.base.workflow.RulesConfigReader.ACTION_KEY;
 import static com.googlesource.gerrit.plugins.its.base.workflow.RulesConfigReader.RULE_SECTION;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.isA;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 import com.google.common.collect.FluentIterable;
 import com.google.common.collect.ImmutableList;
@@ -41,10 +42,10 @@
   private class TestModule extends FactoryModule {
     @Override
     protected void configure() {
-      rulesConfigReader = createMock(RulesConfigReader.class);
+      rulesConfigReader = mock(RulesConfigReader.class);
       bind(RulesConfigReader.class).toInstance(rulesConfigReader);
 
-      projectCache = createMock(ProjectCache.class);
+      projectCache = mock(ProjectCache.class);
       bind(ProjectCache.class).toInstance(projectCache);
 
       bind(String.class)
@@ -79,22 +80,20 @@
     rule1.addActionRequest(action1);
     rule1.addCondition(condition1);
 
-    ProjectState projectState = createMock(ProjectState.class);
-    ProjectLevelConfig projectLevelConfigGlobal = createMock(ProjectLevelConfig.class);
+    ProjectState projectState = mock(ProjectState.class);
+    ProjectLevelConfig projectLevelConfigGlobal = mock(ProjectLevelConfig.class);
     Config projectGlobalCfg = new Config();
     projectGlobalCfg.setString(RULE_SECTION, RULE_1, CONDITION_KEY, VALUE_1);
     projectGlobalCfg.setString(RULE_SECTION, RULE_1, ACTION_KEY, ACTION_1);
-    expect(projectLevelConfigGlobal.get()).andReturn(projectGlobalCfg);
-    expect(projectState.getConfig(RuleBaseKind.GLOBAL.fileName))
-        .andReturn(projectLevelConfigGlobal);
-    ProjectLevelConfig projectLevelConfigPlugin = createMock(ProjectLevelConfig.class);
-    expect(projectLevelConfigPlugin.get()).andReturn(new Config());
-    expect(projectState.getConfig(RuleBaseKind.ITS.fileName)).andReturn(projectLevelConfigPlugin);
-    expect(projectCache.checkedGet(Project.nameKey(TEST_PROJECT))).andReturn(projectState);
-    expect(rulesConfigReader.getRulesFromConfig(isA(Config.class)))
-        .andReturn(ImmutableList.of(rule1))
-        .andReturn(ImmutableList.of());
-    replayMocks();
+    when(projectLevelConfigGlobal.get()).thenReturn(projectGlobalCfg);
+    when(projectState.getConfig(RuleBaseKind.GLOBAL.fileName)).thenReturn(projectLevelConfigGlobal);
+    ProjectLevelConfig projectLevelConfigPlugin = mock(ProjectLevelConfig.class);
+    when(projectLevelConfigPlugin.get()).thenReturn(new Config());
+    when(projectState.getConfig(RuleBaseKind.ITS.fileName)).thenReturn(projectLevelConfigPlugin);
+    when(projectCache.checkedGet(Project.nameKey(TEST_PROJECT))).thenReturn(projectState);
+    when(rulesConfigReader.getRulesFromConfig(any(Config.class)))
+        .thenReturn(ImmutableList.of(rule1))
+        .thenReturn(ImmutableList.of());
 
     ItsRulesProjectCacheImpl.Loader loader =
         injector.getInstance(ItsRulesProjectCacheImpl.Loader.class);
@@ -112,37 +111,34 @@
     rule1.addActionRequest(action1);
     rule1.addCondition(condition1);
 
-    ProjectState projectState = createMock(ProjectState.class);
-    ProjectLevelConfig projectLevelConfigGlobal = createMock(ProjectLevelConfig.class);
-    expect(projectLevelConfigGlobal.get()).andReturn(new Config());
-    expect(projectState.getConfig(RuleBaseKind.GLOBAL.fileName))
-        .andReturn(projectLevelConfigGlobal);
-    ProjectLevelConfig projectLevelConfigPlugin = createMock(ProjectLevelConfig.class);
-    expect(projectLevelConfigPlugin.get()).andReturn(new Config());
-    expect(projectState.getConfig(RuleBaseKind.ITS.fileName)).andReturn(projectLevelConfigPlugin);
+    ProjectState projectState = mock(ProjectState.class);
+    ProjectLevelConfig projectLevelConfigGlobal = mock(ProjectLevelConfig.class);
+    when(projectLevelConfigGlobal.get()).thenReturn(new Config());
+    when(projectState.getConfig(RuleBaseKind.GLOBAL.fileName)).thenReturn(projectLevelConfigGlobal);
+    ProjectLevelConfig projectLevelConfigPlugin = mock(ProjectLevelConfig.class);
+    when(projectLevelConfigPlugin.get()).thenReturn(new Config());
+    when(projectState.getConfig(RuleBaseKind.ITS.fileName)).thenReturn(projectLevelConfigPlugin);
 
-    ProjectState parentProjectState = createMock(ProjectState.class);
-    ProjectLevelConfig parentProjectConfigGlobal = createMock(ProjectLevelConfig.class);
+    ProjectState parentProjectState = mock(ProjectState.class);
+    ProjectLevelConfig parentProjectConfigGlobal = mock(ProjectLevelConfig.class);
     Config parentGlobalCfg = new Config();
     parentGlobalCfg.setString(RULE_SECTION, RULE_1, CONDITION_KEY, VALUE_1);
     parentGlobalCfg.setString(RULE_SECTION, RULE_1, ACTION_KEY, ACTION_1);
-    expect(parentProjectConfigGlobal.get()).andReturn(parentGlobalCfg);
-    expect(parentProjectState.getConfig(RuleBaseKind.GLOBAL.fileName))
-        .andReturn(parentProjectConfigGlobal);
-    ProjectLevelConfig parentProjectConfigPlugin = createMock(ProjectLevelConfig.class);
-    expect(parentProjectConfigPlugin.get()).andReturn(new Config());
-    expect(parentProjectState.getConfig(RuleBaseKind.ITS.fileName))
-        .andReturn(parentProjectConfigPlugin);
-    expect(projectState.parents()).andReturn(FluentIterable.of(parentProjectState));
-    expect(projectCache.checkedGet(Project.nameKey(TEST_PROJECT))).andReturn(projectState);
+    when(parentProjectConfigGlobal.get()).thenReturn(parentGlobalCfg);
+    when(parentProjectState.getConfig(RuleBaseKind.GLOBAL.fileName))
+        .thenReturn(parentProjectConfigGlobal);
+    ProjectLevelConfig parentProjectConfigPlugin = mock(ProjectLevelConfig.class);
+    when(parentProjectConfigPlugin.get()).thenReturn(new Config());
+    when(parentProjectState.getConfig(RuleBaseKind.ITS.fileName))
+        .thenReturn(parentProjectConfigPlugin);
+    when(projectState.parents()).thenReturn(FluentIterable.of(parentProjectState));
+    when(projectCache.checkedGet(Project.nameKey(TEST_PROJECT))).thenReturn(projectState);
 
-    expect(rulesConfigReader.getRulesFromConfig(isA(Config.class)))
-        .andReturn(ImmutableList.of())
-        .andReturn(ImmutableList.of())
-        .andReturn(ImmutableList.of(rule1))
-        .andReturn(ImmutableList.of());
-
-    replayMocks();
+    when(rulesConfigReader.getRulesFromConfig(any(Config.class)))
+        .thenReturn(ImmutableList.of())
+        .thenReturn(ImmutableList.of())
+        .thenReturn(ImmutableList.of(rule1))
+        .thenReturn(ImmutableList.of());
 
     ItsRulesProjectCacheImpl.Loader loader =
         injector.getInstance(ItsRulesProjectCacheImpl.Loader.class);
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/LogEventTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/LogEventTest.java
index 0a26db8..5f82eae 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/LogEventTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/LogEventTest.java
@@ -13,7 +13,8 @@
 // limitations under the License.
 package com.googlesource.gerrit.plugins.its.base.workflow;
 
-import static org.easymock.EasyMock.expect;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 import com.google.common.collect.ImmutableMap;
 import com.google.gerrit.extensions.config.FactoryModule;
@@ -30,33 +31,27 @@
   private ItsFacade its;
 
   public void testNull() throws IOException {
-    ActionRequest actionRequest = createMock(ActionRequest.class);
-    expect(actionRequest.getParameter(1)).andReturn(null);
-
-    replayMocks();
+    ActionRequest actionRequest = mock(ActionRequest.class);
+    when(actionRequest.getParameter(1)).thenReturn(null);
 
     LogEvent logEvent = createLogEvent();
     logEvent.execute(null, "4711", actionRequest, ImmutableMap.of());
   }
 
   public void testEmpty() throws IOException {
-    ActionRequest actionRequest = createMock(ActionRequest.class);
-    expect(actionRequest.getParameter(1)).andReturn("");
-
-    replayMocks();
+    ActionRequest actionRequest = mock(ActionRequest.class);
+    when(actionRequest.getParameter(1)).thenReturn("");
 
     LogEvent logEvent = createLogEvent();
     logEvent.execute(null, "4711", actionRequest, ImmutableMap.of());
   }
 
   public void testLevelDefault() throws IOException {
-    ActionRequest actionRequest = createMock(ActionRequest.class);
-    expect(actionRequest.getParameter(1)).andReturn("");
+    ActionRequest actionRequest = mock(ActionRequest.class);
+    when(actionRequest.getParameter(1)).thenReturn("");
 
     Map<String, String> properties = ImmutableMap.of("KeyA", "ValueA");
 
-    replayMocks();
-
     LogEvent logEvent = createLogEvent();
     logEvent.execute(its, "4711", actionRequest, properties);
 
@@ -64,13 +59,11 @@
   }
 
   public void testLevelError() throws IOException {
-    ActionRequest actionRequest = createMock(ActionRequest.class);
-    expect(actionRequest.getParameter(1)).andReturn("error");
+    ActionRequest actionRequest = mock(ActionRequest.class);
+    when(actionRequest.getParameter(1)).thenReturn("error");
 
     Map<String, String> properties = ImmutableMap.of("KeyA", "ValueA");
 
-    replayMocks();
-
     LogEvent logEvent = createLogEvent();
     logEvent.execute(its, "4711", actionRequest, properties);
 
@@ -78,13 +71,11 @@
   }
 
   public void testLevelWarn() throws IOException {
-    ActionRequest actionRequest = createMock(ActionRequest.class);
-    expect(actionRequest.getParameter(1)).andReturn("warn");
+    ActionRequest actionRequest = mock(ActionRequest.class);
+    when(actionRequest.getParameter(1)).thenReturn("warn");
 
     Map<String, String> properties = ImmutableMap.of("KeyA", "ValueA");
 
-    replayMocks();
-
     LogEvent logEvent = createLogEvent();
     logEvent.execute(its, "4711", actionRequest, properties);
 
@@ -92,13 +83,11 @@
   }
 
   public void testLevelInfo() throws IOException {
-    ActionRequest actionRequest = createMock(ActionRequest.class);
-    expect(actionRequest.getParameter(1)).andReturn("info");
+    ActionRequest actionRequest = mock(ActionRequest.class);
+    when(actionRequest.getParameter(1)).thenReturn("info");
 
     Map<String, String> properties = ImmutableMap.of("KeyA", "ValueA");
 
-    replayMocks();
-
     LogEvent logEvent = createLogEvent();
     logEvent.execute(its, "4711", actionRequest, properties);
 
@@ -106,13 +95,11 @@
   }
 
   public void testLevelDebug() throws IOException {
-    ActionRequest actionRequest = createMock(ActionRequest.class);
-    expect(actionRequest.getParameter(1)).andReturn("debug");
+    ActionRequest actionRequest = mock(ActionRequest.class);
+    when(actionRequest.getParameter(1)).thenReturn("debug");
 
     Map<String, String> properties = ImmutableMap.of("KeyA", "ValueA");
 
-    replayMocks();
-
     LogEvent logEvent = createLogEvent();
     logEvent.execute(its, "4711", actionRequest, properties);
 
@@ -120,8 +107,8 @@
   }
 
   public void testMultipleProperties() throws IOException {
-    ActionRequest actionRequest = createMock(ActionRequest.class);
-    expect(actionRequest.getParameter(1)).andReturn("info");
+    ActionRequest actionRequest = mock(ActionRequest.class);
+    when(actionRequest.getParameter(1)).thenReturn("info");
 
     Map<String, String> properties =
         ImmutableMap.<String, String>builder()
@@ -130,8 +117,6 @@
             .put("KeyC", "ValueC")
             .build();
 
-    replayMocks();
-
     LogEvent logEvent = createLogEvent();
     logEvent.execute(its, "4711", actionRequest, properties);
 
@@ -153,7 +138,7 @@
   private class TestModule extends FactoryModule {
     @Override
     protected void configure() {
-      its = createMock(ItsFacade.class);
+      its = mock(ItsFacade.class);
     }
   }
 }
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/RuleBaseTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/RuleBaseTest.java
index 305e8d1..717886c 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/RuleBaseTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/RuleBaseTest.java
@@ -14,8 +14,9 @@
 
 package com.googlesource.gerrit.plugins.its.base.workflow;
 
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.isA;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
@@ -66,22 +67,20 @@
     String rules = "[rule \"rule1\"]\n\taction = action1\n";
     injectRuleBase(rules);
 
-    Rule rule1 = createMock(Rule.class);
-    ActionRequest actionRequest1 = createMock(ActionRequest.class);
+    Rule rule1 = mock(Rule.class);
+    ActionRequest actionRequest1 = mock(ActionRequest.class);
 
     Map<String, String> properties = ImmutableMap.of(PROJECT_KEY, TEST_PROJECT);
 
     List<ActionRequest> rule1Match = Lists.newArrayListWithCapacity(1);
     rule1Match.add(actionRequest1);
-    expect(rule1.actionRequestsFor(properties)).andReturn(rule1Match);
+    when(rule1.actionRequestsFor(properties)).thenReturn(rule1Match);
 
-    expect(rulesConfigReader.getRulesFromConfig(isA(Config.class)))
-        .andReturn(ImmutableList.of(rule1))
-        .once();
+    when(rulesConfigReader.getRulesFromConfig(any(Config.class)))
+        .thenReturn(ImmutableList.of(rule1))
+        .thenThrow(new UnsupportedOperationException("Method called more than once"));
 
-    expect(rulesProjectCache.get(TEST_PROJECT)).andReturn(ImmutableList.of());
-
-    replayMocks();
+    when(rulesProjectCache.get(TEST_PROJECT)).thenReturn(ImmutableList.of());
 
     RuleBase ruleBase = createRuleBase();
     Collection<ActionRequest> actual = ruleBase.actionRequestsFor(properties);
@@ -101,29 +100,26 @@
             + "[rule \"rule2\"]\n"
             + "\taction = action3\n");
 
-    Rule rule1 = createMock(Rule.class);
-    ActionRequest actionRequest1 = createMock(ActionRequest.class);
-    ActionRequest actionRequest2 = createMock(ActionRequest.class);
+    Rule rule1 = mock(Rule.class);
+    ActionRequest actionRequest1 = mock(ActionRequest.class);
+    ActionRequest actionRequest2 = mock(ActionRequest.class);
 
-    Rule rule2 = createMock(Rule.class);
-    ActionRequest actionRequest3 = createMock(ActionRequest.class);
+    Rule rule2 = mock(Rule.class);
+    ActionRequest actionRequest3 = mock(ActionRequest.class);
 
     Map<String, String> properties = ImmutableMap.of(PROJECT_KEY, TEST_PROJECT);
 
     List<ActionRequest> rule1Match = ImmutableList.of(actionRequest1, actionRequest2);
-    expect(rule1.actionRequestsFor(properties)).andReturn(rule1Match).anyTimes();
+    when(rule1.actionRequestsFor(properties)).thenReturn(rule1Match);
 
     List<ActionRequest> rule2Match = ImmutableList.of(actionRequest3);
-    expect(rule2.actionRequestsFor(properties)).andReturn(rule2Match).anyTimes();
+    when(rule2.actionRequestsFor(properties)).thenReturn(rule2Match);
 
-    expect(rulesProjectCache.get(TEST_PROJECT)).andReturn(ImmutableList.of());
+    when(rulesProjectCache.get(TEST_PROJECT)).thenReturn(ImmutableList.of());
 
-    expect(rulesConfigReader.getRulesFromConfig(isA(Config.class)))
-        .andReturn(ImmutableList.of(rule1, rule2))
-        .andReturn(ImmutableList.of())
-        .anyTimes();
-
-    replayMocks();
+    when(rulesConfigReader.getRulesFromConfig(any(Config.class)))
+        .thenReturn(ImmutableList.of(rule1, rule2))
+        .thenReturn(ImmutableList.of());
 
     RuleBase ruleBase = createRuleBase();
     Collection<ActionRequest> actual = ruleBase.actionRequestsFor(properties);
@@ -140,26 +136,23 @@
 
     Map<String, String> properties = ImmutableMap.of(PROJECT_KEY, TEST_PROJECT);
 
-    Rule rule2 = createMock(Rule.class);
-    ActionRequest actionRequest2 = createMock(ActionRequest.class);
+    Rule rule2 = mock(Rule.class);
+    ActionRequest actionRequest2 = mock(ActionRequest.class);
 
     List<ActionRequest> rule2Match = ImmutableList.of(actionRequest2);
-    expect(rule2.actionRequestsFor(properties)).andReturn(rule2Match);
+    when(rule2.actionRequestsFor(properties)).thenReturn(rule2Match);
 
-    Rule rule3 = createMock(Rule.class);
-    ActionRequest actionRequest3 = createMock(ActionRequest.class);
+    Rule rule3 = mock(Rule.class);
+    ActionRequest actionRequest3 = mock(ActionRequest.class);
 
     List<ActionRequest> rule3Match = ImmutableList.of(actionRequest3);
-    expect(rule3.actionRequestsFor(properties)).andReturn(rule3Match);
+    when(rule3.actionRequestsFor(properties)).thenReturn(rule3Match);
 
-    expect(rulesProjectCache.get(TEST_PROJECT)).andReturn(ImmutableList.of());
+    when(rulesProjectCache.get(TEST_PROJECT)).thenReturn(ImmutableList.of());
 
-    expect(rulesConfigReader.getRulesFromConfig(isA(Config.class)))
-        .andReturn(ImmutableList.of(rule2, rule3))
-        .andReturn(ImmutableList.of())
-        .anyTimes();
-
-    replayMocks();
+    when(rulesConfigReader.getRulesFromConfig(any(Config.class)))
+        .thenReturn(ImmutableList.of(rule2, rule3))
+        .thenReturn(ImmutableList.of());
 
     RuleBase ruleBase = createRuleBase();
 
@@ -171,17 +164,15 @@
   }
 
   public void testProjectConfigIsLoaded() {
-    Rule rule1 = createMock(Rule.class);
-    ActionRequest actionRequest1 = createMock(ActionRequest.class);
+    Rule rule1 = mock(Rule.class);
+    ActionRequest actionRequest1 = mock(ActionRequest.class);
 
     Map<String, String> properties = ImmutableMap.of(PROJECT_KEY, TEST_PROJECT);
 
     List<ActionRequest> rule1Match = ImmutableList.of(actionRequest1);
-    expect(rule1.actionRequestsFor(properties)).andReturn(rule1Match);
+    when(rule1.actionRequestsFor(properties)).thenReturn(rule1Match);
 
-    expect(rulesProjectCache.get(TEST_PROJECT)).andReturn(ImmutableList.of(rule1));
-
-    replayMocks();
+    when(rulesProjectCache.get(TEST_PROJECT)).thenReturn(ImmutableList.of(rule1));
 
     RuleBase ruleBase = createRuleBase();
     Collection<ActionRequest> actual = ruleBase.actionRequestsFor(properties);
@@ -238,10 +229,10 @@
 
       bind(Path.class).annotatedWith(ItsPath.class).toInstance(itsPath);
 
-      rulesConfigReader = createMock(RulesConfigReader.class);
+      rulesConfigReader = mock(RulesConfigReader.class);
       bind(RulesConfigReader.class).toInstance(rulesConfigReader);
 
-      rulesProjectCache = createMock(ItsRulesProjectCache.class);
+      rulesProjectCache = mock(ItsRulesProjectCache.class);
       bind(ItsRulesProjectCache.class).toInstance(rulesProjectCache);
 
       bind(String.class)
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/RuleTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/RuleTest.java
index c106a81..91f5072 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/RuleTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/RuleTest.java
@@ -13,7 +13,8 @@
 // limitations under the License.
 package com.googlesource.gerrit.plugins.its.base.workflow;
 
-import static org.easymock.EasyMock.expect;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.Lists;
@@ -39,11 +40,9 @@
 
     Rule rule = createRule("testRule");
 
-    ActionRequest actionRequest1 = createMock(ActionRequest.class);
+    ActionRequest actionRequest1 = mock(ActionRequest.class);
     rule.addActionRequest(actionRequest1);
 
-    replayMocks();
-
     Collection<ActionRequest> actual = rule.actionRequestsFor(properties);
 
     Collection<ActionRequest> expected = Lists.newArrayListWithCapacity(1);
@@ -56,15 +55,13 @@
 
     Rule rule = createRule("testRule");
 
-    Condition condition1 = createMock(Condition.class);
-    expect(condition1.isMetBy(properties)).andReturn(false).anyTimes();
+    Condition condition1 = mock(Condition.class);
+    when(condition1.isMetBy(properties)).thenReturn(false);
     rule.addCondition(condition1);
 
-    ActionRequest actionRequest1 = createMock(ActionRequest.class);
+    ActionRequest actionRequest1 = mock(ActionRequest.class);
     rule.addActionRequest(actionRequest1);
 
-    replayMocks();
-
     Collection<ActionRequest> actual = rule.actionRequestsFor(properties);
 
     List<ActionRequest> expected = Collections.emptyList();
@@ -76,19 +73,17 @@
 
     Rule rule = createRule("testRule");
 
-    Condition condition1 = createMock(Condition.class);
-    expect(condition1.isMetBy(properties)).andReturn(true).anyTimes();
+    Condition condition1 = mock(Condition.class);
+    when(condition1.isMetBy(properties)).thenReturn(true);
     rule.addCondition(condition1);
 
-    Condition condition2 = createMock(Condition.class);
-    expect(condition2.isMetBy(properties)).andReturn(false).anyTimes();
+    Condition condition2 = mock(Condition.class);
+    when(condition2.isMetBy(properties)).thenReturn(false);
     rule.addCondition(condition2);
 
-    ActionRequest actionRequest1 = createMock(ActionRequest.class);
+    ActionRequest actionRequest1 = mock(ActionRequest.class);
     rule.addActionRequest(actionRequest1);
 
-    replayMocks();
-
     Collection<ActionRequest> actual = rule.actionRequestsFor(properties);
 
     List<ActionRequest> expected = Collections.emptyList();
@@ -100,14 +95,12 @@
 
     Rule rule = createRule("testRule");
 
-    ActionRequest actionRequest1 = createMock(ActionRequest.class);
+    ActionRequest actionRequest1 = mock(ActionRequest.class);
     rule.addActionRequest(actionRequest1);
 
-    ActionRequest actionRequest2 = createMock(ActionRequest.class);
+    ActionRequest actionRequest2 = mock(ActionRequest.class);
     rule.addActionRequest(actionRequest2);
 
-    replayMocks();
-
     Collection<ActionRequest> actual = rule.actionRequestsFor(properties);
 
     List<ActionRequest> expected = Lists.newArrayListWithCapacity(1);
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/RulesConfigReaderTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/RulesConfigReaderTest.java
index 96fb869..12535f2 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/RulesConfigReaderTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/RulesConfigReaderTest.java
@@ -16,7 +16,9 @@
 
 import static com.googlesource.gerrit.plugins.its.base.workflow.RulesConfigReader.ACTION_KEY;
 import static com.googlesource.gerrit.plugins.its.base.workflow.RulesConfigReader.RULE_SECTION;
-import static org.easymock.EasyMock.expect;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 import com.google.common.collect.ImmutableList;
 import com.google.gerrit.extensions.config.FactoryModule;
@@ -31,13 +33,13 @@
   private class TestModule extends FactoryModule {
     @Override
     protected void configure() {
-      ruleFactory = createMock(Rule.Factory.class);
+      ruleFactory = mock(Rule.Factory.class);
       bind(Rule.Factory.class).toInstance(ruleFactory);
 
-      conditionFactory = createMock(Condition.Factory.class);
+      conditionFactory = mock(Condition.Factory.class);
       bind(Condition.Factory.class).toInstance(conditionFactory);
 
-      actionRequestFactory = createMock(ActionRequest.Factory.class);
+      actionRequestFactory = mock(ActionRequest.Factory.class);
       bind(ActionRequest.Factory.class).toInstance(actionRequestFactory);
     }
   }
@@ -63,22 +65,21 @@
     cfg.setString(RULE_SECTION, RULE_1, CONDITION_KEY, VALUE_1);
     cfg.setString(RULE_SECTION, RULE_1, ACTION_KEY, ACTION_1);
 
-    Rule rule1 = createMock(Rule.class);
-    expect(ruleFactory.create(RULE_1)).andReturn(rule1);
+    Rule rule1 = mock(Rule.class);
+    when(ruleFactory.create(RULE_1)).thenReturn(rule1);
 
-    ActionRequest actionRequest1 = createMock(ActionRequest.class);
-    expect(actionRequestFactory.create(ACTION_1)).andReturn(actionRequest1);
-    rule1.addActionRequest(actionRequest1);
+    ActionRequest actionRequest1 = mock(ActionRequest.class);
+    when(actionRequestFactory.create(ACTION_1)).thenReturn(actionRequest1);
 
-    Condition condition1 = createMock(Condition.class);
-    expect(conditionFactory.create(CONDITION_KEY, VALUE_1)).andReturn(condition1);
-    rule1.addCondition(condition1);
-
-    replayMocks();
+    Condition condition1 = mock(Condition.class);
+    when(conditionFactory.create(CONDITION_KEY, VALUE_1)).thenReturn(condition1);
 
     Collection<Rule> expected = ImmutableList.of(rule1);
 
     RulesConfigReader rulesConfigReader = injector.getInstance(RulesConfigReader.class);
     assertEquals("Rules do not match", expected, rulesConfigReader.getRulesFromConfig(cfg));
+
+    verify(rule1).addActionRequest(actionRequest1);
+    verify(rule1).addCondition(condition1);
   }
 }