I have two server objects being mocked and I'm testing some load balancing. I want to make sure the method that means "a server was chosen for a request and is now handling it" is called more on one server than the other.
I have both servers mocked via mockito, but I don't know an elegant way of doing this other than something like:
int server1HandleCount = mockingDetails(server1).getInvocations()
.stream()
.filter(i -> i.getMethod().getName().equals("handle"))
.collect(Collectors.toList())
.size();
And then comparing that with the other. Is there a better way of doing this?
Aucun commentaire:
Enregistrer un commentaire