Skip to content

Instantly share code, notes, and snippets.

@diegoicosta
Last active May 27, 2016 16:45
Show Gist options
  • Save diegoicosta/0ec2fca2cf3d1cd17c81a818bec1aac0 to your computer and use it in GitHub Desktop.
Save diegoicosta/0ec2fca2cf3d1cd17c81a818bec1aac0 to your computer and use it in GitHub Desktop.
Monkito - Verfificando parâmentros que passaram por um mock
@InjectMocks
private MoipAccountTransferExecutor executor;
@Mock
private SchedulingService schedulingService;
/**
* schedulingService é o mock que irá receber List<Scheduling>.
* Saber quantos elementos tem nesta lista é importante para saber se
* a transfer entre constas moip irá gerar a quantidade correta de entries
**/
@Test
public void scheduleOnlyDebitWhenReceiverExistsButMethodEmail() throws Exception {
TransferParams params = buildTransferParams(TransferMethod.EMAIL);
executor.scheduleIt(params, new MoipAccountTransfer());
ArgumentCaptor<List<Scheduling>> argument = ArgumentCaptor
.forClass((Class<List<Scheduling>>) (Class) List.class);
verify(schedulingService).process(argument.capture());
Assert.assertEquals(1, argument.getValue().size());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment