Refactor code incompatible with Mockito 2.7.13
am: a1ba743962
Change-Id: I0b6870f3923c7e4e3c3d25de8114910bc3acda28
diff --git a/tests/unit/src/com/android/tv/dvr/InputTaskSchedulerTest.java b/tests/unit/src/com/android/tv/dvr/InputTaskSchedulerTest.java
index cfc9cf2..85c78ce 100644
--- a/tests/unit/src/com/android/tv/dvr/InputTaskSchedulerTest.java
+++ b/tests/unit/src/com/android/tv/dvr/InputTaskSchedulerTest.java
@@ -19,6 +19,7 @@
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyLong;
import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.after;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.timeout;
import static org.mockito.Mockito.verify;
@@ -142,7 +143,7 @@
verify(mRecordingTasks.get(0), timeout((int) LISTENER_TIMEOUT_MS).times(1)).start();
// The first schedule should not be stopped because the second one should wait for the end
// of the first schedule.
- verify(mRecordingTasks.get(0), timeout((int) LISTENER_TIMEOUT_MS).never()).stop();
+ verify(mRecordingTasks.get(0), after((int) LISTENER_TIMEOUT_MS).never()).stop();
}
public void testAddSchedule_consecutiveNoFail() throws Exception {
@@ -162,9 +163,9 @@
LOW_PRIORITY, startTimeMs, endTimeMs));
mScheduler.handleBuildSchedule();
verify(mRecordingTasks.get(0), timeout((int) LISTENER_TIMEOUT_MS).times(1)).start();
- verify(mRecordingTasks.get(0), timeout((int) LISTENER_TIMEOUT_MS).never()).stop();
+ verify(mRecordingTasks.get(0), after((int) LISTENER_TIMEOUT_MS).never()).stop();
// The second schedule should not fail because it can starts after the first one finishes.
- verify(mDataManager, timeout((int) LISTENER_TIMEOUT_MS).never())
+ verify(mDataManager, after((int) LISTENER_TIMEOUT_MS).never())
.changeState(any(ScheduledRecording.class),
eq(ScheduledRecording.STATE_RECORDING_FAILED));
}
@@ -186,7 +187,7 @@
HIGH_PRIORITY, startTimeMs, endTimeMs));
mScheduler.handleBuildSchedule();
verify(mRecordingTasks.get(0), timeout((int) LISTENER_TIMEOUT_MS).times(1)).start();
- verify(mRecordingTasks.get(0), timeout((int) LISTENER_TIMEOUT_MS).never()).stop();
+ verify(mRecordingTasks.get(0), after((int) LISTENER_TIMEOUT_MS).never()).stop();
// The second schedule should wait until the first one finishes rather than creating a new
// session even though there are available tuners.
assertTrue(mRecordingTasks.size() == 1);
@@ -199,7 +200,7 @@
mScheduler.handleAddSchedule(r);
mScheduler.handleBuildSchedule();
mScheduler.handleUpdateSchedule(r);
- verify(mRecordingTasks.get(0), timeout((int) LISTENER_TIMEOUT_MS).never()).cancel();
+ verify(mRecordingTasks.get(0), after((int) LISTENER_TIMEOUT_MS).never()).cancel();
}
public void testUpdateSchedule_cancel() throws Exception {
diff --git a/tests/unit/src/com/android/tv/dvr/RecordingTaskTest.java b/tests/unit/src/com/android/tv/dvr/RecordingTaskTest.java
index 13ad9b0..7404a55 100644
--- a/tests/unit/src/com/android/tv/dvr/RecordingTaskTest.java
+++ b/tests/unit/src/com/android/tv/dvr/RecordingTaskTest.java
@@ -21,10 +21,10 @@
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.argThat;
import static org.mockito.Matchers.eq;
-import static org.mockito.Matchers.longThat;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;
+import static org.mockito.hamcrest.MockitoHamcrest.longThat;
import android.os.Build;
import android.os.Handler;
@@ -43,9 +43,9 @@
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
-import org.mockito.ArgumentMatcher;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
+import org.mockito.compat.ArgumentMatcher;
import java.util.concurrent.TimeUnit;
@@ -157,10 +157,10 @@
private static ArgumentMatcher<Message> messageMatchesWhat(final int what) {
return new ArgumentMatcher<Message>() {
@Override
- public boolean matches(Object argument) {
+ public boolean matchesObject(Object argument) {
Message message = (Message) argument;
return message.what == what;
}
};
}
-}
\ No newline at end of file
+}