songining
Spring Mockito when().thenReturn 과 doReturn.when()의 차이
BACKEND/Spring 2022. 8. 1. 16:29

Typically, stubbing argument mismatch indicates user mistake when writing tests. Mockito fails early so that you can debug potential problem easily. However, there are legit scenarios when this exception generates false negative signal: - stubbing the same method multiple times using 'given().will()' or 'when().then()' API Please use 'will().given()' or 'doReturn().when()' API for stubbing. - st..