You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problematic code (if that's possible) is copied here;
class A {
B callee;
public A(B callee) {
this.callee = callee;
callee.setCallback(this);
}
public void call(String val) {
callee.executeAndCallback(val);
}
public void receive(String val) {
System.out.println("Received: " + val);
}
}
class B {
A callback;
public void setCallback(A callback) {
this.callback = callback;
}
public void executeAndCallback(String val) {
callback.receive(val);
}
}
@Test
void test() {
//given
B b = new B();
A a = new A(b);
A spyA = spy(a);
//when
spyA.call("123");
//then
verify(spyA, times(1)).receive(anyString());
}
Provide versions (mockito / jdk / os / any other relevant information)
check that
The problematic code (if that's possible) is copied here;
Provide versions (mockito / jdk / os / any other relevant information)
mockito-core - 5.11.0
junit-jupiter - 5.10.2
java 17
W10
Error
Wanted but not invoked:
a.receive();
-> at dk.bec.mortgage.resultclient.service.POC_Test$A.receive(POC_Test.java:24)
However, there was exactly 1 interaction with this mock:
a.call("123");
-> at dk.bec.mortgage.resultclient.service.POC_Test.test(POC_Test.java:47)
The text was updated successfully, but these errors were encountered: