Skip to content

Commit 95663cf

Browse files
committed
fix unit test
1 parent cb50fe3 commit 95663cf

File tree

5 files changed

+13
-23
lines changed

5 files changed

+13
-23
lines changed

src/test/java/com/uber/cadence/internal/replay/ReplayDeciderCacheTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ public void evictAnyWillInvalidateAnEntryRandomlyFromTheCache() throws Exception
209209
// Wait for reporter
210210
Thread.sleep(600);
211211
verify(reporter, atLeastOnce())
212-
.reportCounter(eq(MetricsType.STICKY_CACHE_TOTAL_FORCED_EVICTION), eq(tags), anyInt());
212+
.reportCounter(eq(MetricsType.STICKY_CACHE_TOTAL_FORCED_EVICTION), eq(tags), anyLong());
213213
}
214214

215215
@Test

src/test/java/com/uber/cadence/internal/sync/DeterministicRunnerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ public void workflowThreadsWillEvictCacheWhenMaxThreadCountIsHit() throws Throwa
779779
// Wait for reporter
780780
Thread.sleep(600);
781781
verify(reporter, atLeastOnce())
782-
.reportCounter(eq(MetricsType.STICKY_CACHE_THREAD_FORCED_EVICTION), eq(tags), anyInt());
782+
.reportCounter(eq(MetricsType.STICKY_CACHE_THREAD_FORCED_EVICTION), eq(tags), anyLong());
783783
}
784784

785785
@Test

src/test/java/com/uber/cadence/internal/worker/WorkerShutDownHandlerTest.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,15 @@
3232
import org.mockito.Mock;
3333

3434
public class WorkerShutDownHandlerTest {
35-
@Before
36-
public void setUp() {
37-
mockClient = mock(WorkflowClient.class);
38-
mockService = mock(IWorkflowService.class);
39-
}
4035

4136
@Mock private WorkflowClient mockClient;
4237

4338
@Mock private IWorkflowService mockService;
4439

4540
@Before
4641
public void setup() {
42+
mockClient = mock(WorkflowClient.class);
43+
mockService = mock(IWorkflowService.class);
4744
WorkflowClientOptions clientOptions =
4845
WorkflowClientOptions.newBuilder().setMetricsScope(new NoopScope()).build();
4946
when(mockClient.getOptions()).thenReturn(clientOptions);

src/test/java/com/uber/cadence/worker/StickyWorkerTest.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
import static org.junit.Assert.assertEquals;
2222
import static org.junit.Assert.assertNotNull;
2323
import static org.junit.Assert.assertNull;
24-
import static org.mockito.ArgumentMatchers.anyInt;
25-
import static org.mockito.ArgumentMatchers.eq;
24+
import static org.mockito.ArgumentMatchers.*;
2625
import static org.mockito.Mockito.atLeastOnce;
2726
import static org.mockito.Mockito.mock;
2827
import static org.mockito.Mockito.never;
@@ -156,8 +155,8 @@ public void whenStickyIsEnabledThenTheWorkflowIsCachedSignals() throws Exception
156155
.build();
157156
Thread.sleep(600);
158157
verify(reporter, atLeastOnce())
159-
.reportCounter(eq(MetricsType.STICKY_CACHE_HIT), eq(tags), anyInt());
160-
verify(reporter, never()).reportCounter(eq(MetricsType.STICKY_CACHE_MISS), eq(tags), anyInt());
158+
.reportCounter(eq(MetricsType.STICKY_CACHE_HIT), eq(tags), anyLong());
159+
verify(reporter, never()).reportCounter(eq(MetricsType.STICKY_CACHE_MISS), eq(tags), anyLong());
161160

162161
// Finish Workflow
163162
wrapper.close();
@@ -269,8 +268,8 @@ public void whenStickyIsEnabledThenTheWorkflowIsCachedActivities() throws Except
269268
.put(MetricsTag.TASK_LIST, STICKY_TASK_LIST_METRIC_TAG)
270269
.build();
271270
verify(reporter, atLeastOnce())
272-
.reportCounter(eq(MetricsType.STICKY_CACHE_HIT), eq(tags), anyInt());
273-
verify(reporter, never()).reportCounter(eq(MetricsType.STICKY_CACHE_MISS), eq(tags), anyInt());
271+
.reportCounter(eq(MetricsType.STICKY_CACHE_HIT), eq(tags), anyLong());
272+
verify(reporter, never()).reportCounter(eq(MetricsType.STICKY_CACHE_MISS), eq(tags), anyLong());
274273

275274
// Finish Workflow
276275
wrapper.close();
@@ -318,8 +317,8 @@ public void whenStickyIsEnabledThenTheWorkflowIsCachedChildWorkflows() throws Ex
318317
.put(MetricsTag.TASK_LIST, STICKY_TASK_LIST_METRIC_TAG)
319318
.build();
320319
verify(reporter, atLeastOnce())
321-
.reportCounter(eq(MetricsType.STICKY_CACHE_HIT), eq(tags), anyInt());
322-
verify(reporter, never()).reportCounter(eq(MetricsType.STICKY_CACHE_MISS), eq(tags), anyInt());
320+
.reportCounter(eq(MetricsType.STICKY_CACHE_HIT), eq(tags), anyLong());
321+
verify(reporter, never()).reportCounter(eq(MetricsType.STICKY_CACHE_MISS), eq(tags), anyLong());
323322
// Finish Workflow
324323
wrapper.close();
325324
}
@@ -374,8 +373,8 @@ public void whenStickyIsEnabledThenTheWorkflowIsCachedMutableSideEffect() throws
374373
.put(MetricsTag.TASK_LIST, STICKY_TASK_LIST_METRIC_TAG)
375374
.build();
376375
verify(reporter, atLeastOnce())
377-
.reportCounter(eq(MetricsType.STICKY_CACHE_HIT), eq(tags), anyInt());
378-
verify(reporter, never()).reportCounter(eq(MetricsType.STICKY_CACHE_MISS), eq(tags), anyInt());
376+
.reportCounter(eq(MetricsType.STICKY_CACHE_HIT), eq(tags), anyLong());
377+
verify(reporter, never()).reportCounter(eq(MetricsType.STICKY_CACHE_MISS), eq(tags), anyLong());
379378
// Finish Workflow
380379
wrapper.close();
381380
}

src/test/java/com/uber/cadence/workflow/WorkflowTest.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
import static org.junit.Assert.assertTrue;
2828
import static org.junit.Assert.fail;
2929
import static org.junit.Assume.assumeTrue;
30-
import static org.mockito.Mockito.mock;
31-
import static org.mockito.Mockito.when;
3230

3331
import com.google.common.base.Strings;
3432
import com.google.common.util.concurrent.UncheckedExecutionException;
@@ -5730,10 +5728,6 @@ public String getState() {
57305728

57315729
@Test
57325730
public void testGetVersionRetry() throws ExecutionException, InterruptedException {
5733-
TestActivities activity = mock(TestActivities.class);
5734-
when(activity.activity1(1)).thenReturn(1);
5735-
cadenceTestRule.getWorker().registerActivitiesImplementations(activity);
5736-
57375731
startWorkerFor(TestGetVersionWorkflowRetryImpl.class);
57385732
TestWorkflow3 workflowStub =
57395733
workflowClient.newWorkflowStub(

0 commit comments

Comments
 (0)