Skip to content

Commit

Permalink
Remove deprecated verifyZeroInteractions.
Browse files Browse the repository at this point in the history
Method is deprecated in mockito 3+ and is actually another name for verifyNoMoreInteractions
mockito/mockito-kotlin#383, and not to be
confused with verifyNoInteractions.

Bug: 1340593
Change-Id: I2c0840d8f4e2fb5cca9c462afc98d265f5841c3c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4234150
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: David Benjamin <davidben@chromium.org>
Commit-Queue: Benjamin Joyce (Ben) <bjoyce@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1103359}


CrOS-Libchrome-Original-Commit: 2f5120ed4d532e89ac303f8dfb2d17d187ace6b6
  • Loading branch information
Ben Joyce authored and chromeos-ci-prod committed Feb 10, 2023
1 parent 5f499c3 commit 01f97b5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
package org.chromium.base.jank_tracker;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;

import android.view.FrameMetrics;
Expand Down Expand Up @@ -37,7 +37,7 @@ public void testMetricRecording_OffByDefault() {
// By default metrics shouldn't be logged.
Assert.assertEquals(
0, store.stopTrackingScenario(JankScenario.PERIODIC_REPORTING).durationsNs.length);
verifyZeroInteractions(frameMetrics);
verifyNoMoreInteractions(frameMetrics);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.verifyZeroInteractions;

import org.junit.Before;
import org.junit.Rule;
Expand Down Expand Up @@ -87,6 +86,6 @@ public void testStopTracking_emptyStoreShouldntRecordAnything() {
verify(metricsStore).stopTrackingScenario(JankScenario.TAB_SWITCHER);

// Native shouldn't be called when there are no measurements.
verifyZeroInteractions(mNativeMock);
verifyNoMoreInteractions(mNativeMock);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.verifyZeroInteractions;

import androidx.test.filters.MediumTest;

Expand Down Expand Up @@ -51,7 +50,7 @@ public void testSetDelegateWithEmptyCache() {

cachingUmaRecorder.setDelegate(mUmaRecorder);

verifyZeroInteractions(mUmaRecorder);
verifyNoMoreInteractions(mUmaRecorder);
}

@Test
Expand Down Expand Up @@ -236,7 +235,7 @@ public void testSetDelegateStopsOldDelegation() {
cachingUmaRecorder.setDelegate(new NoopUmaRecorder());
cachingUmaRecorder.recordSparseHistogram("CachingUmaRecorderTest.stopOldDelegation", 72);

verifyZeroInteractions(mUmaRecorder);
verifyNoMoreInteractions(mUmaRecorder);
}

@Test
Expand Down Expand Up @@ -293,7 +292,7 @@ public void testSetDelegateBlocksUntilRecordingDone() throws Exception {

recordingThread.join();
swappingThread.join();
verifyZeroInteractions(mUmaRecorder);
verifyNoMoreInteractions(mUmaRecorder);
}

@SuppressWarnings("ThreadPriorityCheck")
Expand Down Expand Up @@ -403,7 +402,7 @@ public void testStressParallelHistograms() throws Exception {
thread.join();
}
cachingRecorder.setDelegate(mUmaRecorder);
verifyZeroInteractions(mUmaRecorder);
verifyNoMoreInteractions(mUmaRecorder);
for (int i = 0; i < numThreads; i++) {
int actualSamples = 0;
for (HistogramTestingUmaRecorder recorder : testingRecorders) {
Expand Down Expand Up @@ -512,7 +511,7 @@ public void testStressParallelUserActions() throws Exception {
thread.join();
}
cachingRecorder.setDelegate(mUmaRecorder);
verifyZeroInteractions(mUmaRecorder);
verifyNoMoreInteractions(mUmaRecorder);
for (int i = 0; i < numThreads; i++) {
int actualSamples = 0;
for (UserActionTestingUmaRecorder recorder : testingRecorders) {
Expand Down Expand Up @@ -586,7 +585,7 @@ public void testUserActionCallbacksSwappedBetweenDelegates() {
// Ensure a callback added later is also added correctly.
Callback<String> testCallback3 = (result) -> {};
cachingRecorder.addUserActionCallbackForTesting(testCallback3);
verifyZeroInteractions(delegate1);
verifyNoMoreInteractions(delegate1);
verify(delegate2).addUserActionCallbackForTesting(testCallback3);
}
}

0 comments on commit 01f97b5

Please sign in to comment.