Я пытался запустить модульный тест Mockito, но он выдал ошибку `Strict Stubging аргументы несоответствия.
Кто-нибудь знает, почему произошла эта ошибка, что-то не так с моим кодом?
Буду очень признателен за любой ответ.
Код: Выделить всё
Please check:
this invocation of 'getCoopPipelineItems' method: aggregateService.getCoopPipelineItems( [0], "submitted", "filter", Mock for Pageable, hashCode: 2037183157 ); -> at io.portfolioaggregate.service.rest.PortfolioAggregateRestController.getCoopPipelineOutlinesWithFilter(PortfolioAggregateRestController.java:92)
has following stubbing(s) with different arguments:
aggregateService.getCoopPipelineItems( [0], "", "", null );
Код: Выделить всё
@Test
public void getCoopPipelineOutlinesWithFilter_returnsExpectedResult() {
PagedResult
expected = mock(PagedResult.class);
when(aggregateService.getCoopPipelineItems(List.of(anyInt()), anyString(), anyString(), any(Pageable.class)))
.thenReturn(expected);
List orgIds = List.of(0);
PagedResult result = controller.getCoopPipelineOutlinesWithFilter(orgIds, "submitted", "filter", mock(Pageable.class));
Assertions.assertEquals(expected, result);
verify(aggregateService).getCoopPipelineItems(orgIds, "submitted", "filter",
mock(Pageable.class));
}
Подробнее здесь: https://stackoverflow.com/questions/786 ... t-mismatch
Мобильная версия