Merge branch 'stable-3.0' into stable-3.1
* stable-3.0:
Upgrade bazlets to latest stable-3.0 to build with 3.0.12 API
Upgrade bazlets to latest stable-2.16 to build with 2.16.22 API
Change-Id: I49d3160ce40e6b1d39b541d646769bdf10ed4ca4
diff --git a/.gitignore b/.gitignore
index 72f041f..78857a0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@
/.settings/
/bazel-*
/eclipse-out/
+/.apt_generated/
diff --git a/WORKSPACE b/WORKSPACE
index 78e24e7..bbc882e 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -3,7 +3,7 @@
load("//:bazlets.bzl", "load_bazlets")
load_bazlets(
- commit = "6d2b8f41ed34dad925b767399d1e4be378abb029",
+ commit = "b6cb89690a5e06261932eb30c95fd8db34a7943a",
#local_path = "/home/<user>/projects/bazlets",
)
diff --git a/src/test/java/com/ericsson/gerrit/plugins/heartbeat/HeartbeatDaemonTest.java b/src/test/java/com/ericsson/gerrit/plugins/heartbeat/HeartbeatDaemonTest.java
index 35c8347..0b796ff 100644
--- a/src/test/java/com/ericsson/gerrit/plugins/heartbeat/HeartbeatDaemonTest.java
+++ b/src/test/java/com/ericsson/gerrit/plugins/heartbeat/HeartbeatDaemonTest.java
@@ -14,14 +14,11 @@
package com.ericsson.gerrit.plugins.heartbeat;
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.createNiceMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.expectLastCall;
-import static org.easymock.EasyMock.isA;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.reset;
-import static org.easymock.EasyMock.verify;
+import static org.mockito.ArgumentMatchers.any;
+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.gerrit.extensions.registration.DynamicItem;
import com.google.gerrit.server.events.EventDispatcher;
@@ -36,27 +33,19 @@
@SuppressWarnings("unchecked")
@Before
public void setUp() throws Exception {
- eventDispatcherMock = createNiceMock(EventDispatcher.class);
- replay(eventDispatcherMock);
- DynamicItem<EventDispatcher> dynamicEventDispatcherMock = createNiceMock(DynamicItem.class);
- expect(dynamicEventDispatcherMock.get()).andReturn(eventDispatcherMock).anyTimes();
- replay(dynamicEventDispatcherMock);
- HeartbeatConfig heartbeatConfigMock = createMock(HeartbeatConfig.class);
- expect(heartbeatConfigMock.getDelay()).andReturn(1).anyTimes();
- replay(heartbeatConfigMock);
+ eventDispatcherMock = mock(EventDispatcher.class);
+ DynamicItem<EventDispatcher> dynamicEventDispatcherMock = mock(DynamicItem.class);
+ when(dynamicEventDispatcherMock.get()).thenReturn(eventDispatcherMock);
+ HeartbeatConfig heartbeatConfigMock = mock(HeartbeatConfig.class);
+ when(heartbeatConfigMock.getDelay()).thenReturn(1);
heartbeatDaemon = new HeartbeatDaemon(dynamicEventDispatcherMock, heartbeatConfigMock);
}
@Test
public void thatDaemonSendsHeartbeatEvents() throws Exception {
- reset(eventDispatcherMock);
- eventDispatcherMock.postEvent(isA(HeartbeatEvent.class));
- expectLastCall().atLeastOnce();
- replay(eventDispatcherMock);
-
heartbeatDaemon.start();
TimeUnit.MILLISECONDS.sleep(500);
- verify(eventDispatcherMock);
+ verify(eventDispatcherMock, atLeastOnce()).postEvent(any(HeartbeatEvent.class));
heartbeatDaemon.stop();
}
}