In my code I have
kiteOrderService.modifyOrder(params, profitBracketOrder.getOrder().orderId);
and another invocation at another place. Via stepping through I have verified that the first invocation params.price is 525 and for the second it is 475. Yet in the test code
verify(mockKiteOrderService, times(2)).modifyOrder(orderParamsArgumentCaptor.capture(), eq("3"));
List<OrderParams> orderParamsCaptured = orderParamsArgumentCaptor.getAllValues();
assertThat(orderParamsCaptured.get(0).price).isEqualTo(525.0);
assertThat(orderParamsCaptured.get(1).price).isEqualTo(475.0);
orderParamsCaptured.get(0).price is 475 and this is the value captured for both invocations.
In my build.gradle I didn't have any mockito dependency specified, I have
testImplementation ('org.junit.vintage:junit-vintage-engine'){
exclude group: 'org.hamcrest' , module :'hamcrest-core'
}
I have also tried adding
testImplementation group: 'org.mockito', name: 'mockito-core', version: '5.3.1'
but it didn't make any difference. I don't know which mockito version is getting used, I'm pasting my build.gradle below:
dependencies {
implementation ('org.springframework.boot:spring-boot-starter-web')
implementation group: 'com.google.truth', name: 'truth', version: '1.1.3'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation ('org.junit.vintage:junit-vintage-engine'){
exclude group: 'org.hamcrest' , module :'hamcrest-core'
}
}
that may be relevant. My test is not a spring boot test but a normal Junit5 unit test has has the annotation
@ExtendWith(MockitoExtension.class)
Any help is much appreciated.