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.

For more information see []

Tested:
    TAP --sample ran all affected tests and none failed
    []

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=250690285
This commit is contained in:
jianglai 2019-05-30 08:14:32 -07:00
parent 28393e569c
commit ef9478b68c
5 changed files with 16 additions and 13 deletions

View file

@ -48,7 +48,7 @@ import javax.annotation.Nullable;
import org.joda.time.DateTime;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
import org.mockito.ArgumentMatchers;
/** Unit tests for {@link GenerateAllocationTokensCommand}. */
public class GenerateAllocationTokensCommandTest
@ -93,7 +93,7 @@ public class GenerateAllocationTokensCommandTest
.doThrow(fakeException)
.doCallRealMethod()
.when(spyCommand)
.saveTokens(Mockito.any());
.saveTokens(ArgumentMatchers.any());
runCommand("--number", "1");
assertAllocationTokens(createToken("123456789ABCDEFG", null, null));
assertInStdout("123456789ABCDEFG");