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

@ -40,8 +40,8 @@ import org.joda.money.CurrencyUnit;
import org.joda.time.DateTime;
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentMatchers;
import org.mockito.Mock;
import org.mockito.Mockito;
/** Unit tests for {@link CreateRegistrarCommand}. */
public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarCommand> {
@ -238,10 +238,10 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
@Test
public void testFailure_groupCreationFails() throws Exception {
when(connection.sendPostRequest(
Mockito.anyString(),
Mockito.anyMap(),
Mockito.any(MediaType.class),
Mockito.any(byte[].class)))
ArgumentMatchers.anyString(),
ArgumentMatchers.anyMap(),
ArgumentMatchers.any(MediaType.class),
ArgumentMatchers.any(byte[].class)))
.thenThrow(new IOException("BAD ROBOT NO COOKIE"));
runCommandForced(
"--name=blobio",