Skip to content

Commit e59b70d

Browse files
Material Design Teamikim24
authored andcommitted
Migrate org.mockito.Matchers#any* to org.mockito.ArgumentMatchers
The former is deprecated and replaced by the latter in Mockito 2. However, there is a functional difference: ArgumentMatchers will reject `null` and check the type if the matcher specified a type (e.g. `any(Class)` or `anyInt()`). `any()` will remain to accept anything. PiperOrigin-RevId: 257199827
1 parent 15e1055 commit e59b70d

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

lib/javatests/com/google/android/material/circularreveal/CircularRevealHelperTest.java

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
package com.google.android.material.circularreveal;
1717

1818
import static com.google.common.truth.Truth.assertThat;
19-
import static org.mockito.Matchers.anyFloat;
19+
import static org.mockito.ArgumentMatchers.anyFloat;
2020
import static org.mockito.Matchers.eq;
2121
import static org.mockito.Mockito.never;
2222
import static org.mockito.Mockito.spy;
@@ -40,7 +40,7 @@
4040
import org.junit.Before;
4141
import org.junit.Test;
4242
import org.junit.runner.RunWith;
43-
import org.mockito.Matchers;
43+
import org.mockito.ArgumentMatchers;
4444
import org.robolectric.Robolectric;
4545
import org.robolectric.RobolectricTestRunner;
4646
import org.robolectric.annotation.Config;
@@ -102,8 +102,8 @@ public void jbUsesBitmapShaderStrategy() {
102102
eq(smallRevealInfo.centerX),
103103
eq(smallRevealInfo.centerY),
104104
eq(smallRevealInfo.radius),
105-
Matchers.<Paint>any());
106-
verify(canvas, never()).clipPath(Matchers.<Path>any());
105+
ArgumentMatchers.<Paint>any());
106+
verify(canvas, never()).clipPath(ArgumentMatchers.<Path>any());
107107
}
108108

109109
@Test
@@ -114,8 +114,9 @@ public void jbMr2UsesClipPathStrategy() {
114114

115115
helper.draw(canvas);
116116

117-
verify(canvas).clipPath(Matchers.<Path>any());
118-
verify(canvas, never()).drawCircle(anyFloat(), anyFloat(), anyFloat(), Matchers.<Paint>any());
117+
verify(canvas).clipPath(ArgumentMatchers.<Path>any());
118+
verify(canvas, never())
119+
.drawCircle(anyFloat(), anyFloat(), anyFloat(), ArgumentMatchers.<Paint>any());
119120
}
120121

121122
@Test
@@ -126,8 +127,9 @@ public void lUsesRevealAnimatorStrategy() {
126127

127128
helper.draw(canvas);
128129

129-
verify(canvas, never()).clipPath(Matchers.<Path>any());
130-
verify(canvas, never()).drawCircle(anyFloat(), anyFloat(), anyFloat(), Matchers.<Paint>any());
130+
verify(canvas, never()).clipPath(ArgumentMatchers.<Path>any());
131+
verify(canvas, never())
132+
.drawCircle(anyFloat(), anyFloat(), anyFloat(), ArgumentMatchers.<Paint>any());
131133
}
132134

133135
@Test
@@ -148,7 +150,7 @@ public void jbDrawsScrim() {
148150
eq(smallRevealInfo.centerX),
149151
eq(smallRevealInfo.centerY),
150152
eq(smallRevealInfo.radius),
151-
Matchers.<Paint>any());
153+
ArgumentMatchers.<Paint>any());
152154
}
153155

154156
@Test
@@ -166,7 +168,7 @@ public void jbMr2DrawsScrim() {
166168
eq(0f),
167169
eq((float) DELEGATE_WIDTH),
168170
eq((float) DELEGATE_HEIGHT),
169-
Matchers.<Paint>any());
171+
ArgumentMatchers.<Paint>any());
170172
}
171173

172174
@Test
@@ -184,7 +186,7 @@ public void lDrawsScrim() {
184186
eq(0f),
185187
eq((float) DELEGATE_WIDTH),
186188
eq((float) DELEGATE_HEIGHT),
187-
Matchers.<Paint>any());
189+
ArgumentMatchers.<Paint>any());
188190
}
189191

190192
private static class TestDelegate extends View implements CircularRevealWidget {

0 commit comments

Comments
 (0)