The issue is I have two argumentCaptors, and i need to use Mockito.when().then() two times, with this argumentCaptors.capture() in paramenets of method inside when(). But It run two times second argumentCaptor.capture()
i know that in verify i can use argumentCaptor.getAllValues().get(i), and get any of values of current argumentCaptors, but i can not find something about how to use the same thing for capture() method, inside Mockito.when()
Set ordersBuy = mock(Set.class); Set ordersSell = mock(Set.class);
ArgumentCaptor<Function<CurrencyPairDTO, String >> getBase = ArgumentCaptor.forClass(Function.class);
ArgumentCaptor<Function<CurrencyPairDTO, String>> getCounter = ArgumentCaptor.forClass(Function.class);
ArgumentCaptor<Function<MyOrdersSmartDTO, Set<String>>> getSell = ArgumentCaptor.forClass(Function.class);
ArgumentCaptor<Function<MyOrdersSmartDTO, Set<String>>> getBuy = ArgumentCaptor.forClass(Function.class);
when(this.recalculateInMemoryBoardUtils.fillSetByMarginOrdersUsingFunctions(eq(instancesByUsername), eq(currencyBase), getBase.capture(), getSell.capture())).thenReturn(ordersSell);
when(this.recalculateInMemoryBoardUtils.fillSetByMarginOrdersUsingFunctions(eq(instancesByUsername), eq(currencyBase), getCounter.capture(), getBuy.capture())).thenReturn(ordersBuy);
i received two times ordersBuy instead of ordersSell, ordersBuy
Aucun commentaire:
Enregistrer un commentaire