I have a test using Mockito that has a very strange behavior : it works in debug but fails when running normally. After some investigation, I realized it's because I am mocking methods behavior, passing a list of elements to match. But for some reason, order in the list is not always the same so it doesn't match and what I expect my mock to return is not returned, because the 2 lists are not "equals"
when(mockStatusCalculatorService.calculateStatus(Arrays.asList(IN_PROGRESS, ABANDONNED,EXPIRED))).thenReturn(ConsolidatedStatus.EXPIRED);
In my case, order of elements to match doesn't matter. So how can I specify this when configuring my mock ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…