Skip to content

Commit

Permalink
Migrate org.mockito.Matchers#any* to org.mockito.ArgumentMatchers
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Material Design Team authored and ikim24 committed Jul 9, 2019
1 parent 15e1055 commit e59b70d
Showing 1 changed file with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
package com.google.android.material.circularreveal;

import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Matchers.anyFloat;
import static org.mockito.ArgumentMatchers.anyFloat;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.spy;
Expand All @@ -40,7 +40,7 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Matchers;
import org.mockito.ArgumentMatchers;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
Expand Down Expand Up @@ -102,8 +102,8 @@ public void jbUsesBitmapShaderStrategy() {
eq(smallRevealInfo.centerX),
eq(smallRevealInfo.centerY),
eq(smallRevealInfo.radius),
Matchers.<Paint>any());
verify(canvas, never()).clipPath(Matchers.<Path>any());
ArgumentMatchers.<Paint>any());
verify(canvas, never()).clipPath(ArgumentMatchers.<Path>any());
}

@Test
Expand All @@ -114,8 +114,9 @@ public void jbMr2UsesClipPathStrategy() {

helper.draw(canvas);

verify(canvas).clipPath(Matchers.<Path>any());
verify(canvas, never()).drawCircle(anyFloat(), anyFloat(), anyFloat(), Matchers.<Paint>any());
verify(canvas).clipPath(ArgumentMatchers.<Path>any());
verify(canvas, never())
.drawCircle(anyFloat(), anyFloat(), anyFloat(), ArgumentMatchers.<Paint>any());
}

@Test
Expand All @@ -126,8 +127,9 @@ public void lUsesRevealAnimatorStrategy() {

helper.draw(canvas);

verify(canvas, never()).clipPath(Matchers.<Path>any());
verify(canvas, never()).drawCircle(anyFloat(), anyFloat(), anyFloat(), Matchers.<Paint>any());
verify(canvas, never()).clipPath(ArgumentMatchers.<Path>any());
verify(canvas, never())
.drawCircle(anyFloat(), anyFloat(), anyFloat(), ArgumentMatchers.<Paint>any());
}

@Test
Expand All @@ -148,7 +150,7 @@ public void jbDrawsScrim() {
eq(smallRevealInfo.centerX),
eq(smallRevealInfo.centerY),
eq(smallRevealInfo.radius),
Matchers.<Paint>any());
ArgumentMatchers.<Paint>any());
}

@Test
Expand All @@ -166,7 +168,7 @@ public void jbMr2DrawsScrim() {
eq(0f),
eq((float) DELEGATE_WIDTH),
eq((float) DELEGATE_HEIGHT),
Matchers.<Paint>any());
ArgumentMatchers.<Paint>any());
}

@Test
Expand All @@ -184,7 +186,7 @@ public void lDrawsScrim() {
eq(0f),
eq((float) DELEGATE_WIDTH),
eq((float) DELEGATE_HEIGHT),
Matchers.<Paint>any());
ArgumentMatchers.<Paint>any());
}

private static class TestDelegate extends View implements CircularRevealWidget {
Expand Down

0 comments on commit e59b70d

Please sign in to comment.