I have a method in my test class that just calls two other methods. I am trying to write a test that checks that those two methods are actually invoced, but no invocations are registered. Java code I'm testing:
public void populateEdgeInfo(Map<Actor, SchedulableNode> knownNodes) {
populateDestinationInfo(knownNodes);
populateSourceInfo(knownNodes);
}
My test code:
def "Populating edge info means both source and destination information will be populated" () {
given:
actor.getDstChannels() >> []
actor.getSrcChannels() >> []
SchedulableNode schedulable = Spy(SchedulableNode, constructorArgs: [actor])
when:
schedulable.populateEdgeInfo([:])
then:
1 * schedulable.populateDestinationInfo(_)
1 * schedulable.populateSourceInfo(_)
}
The only thing registered is the call to populateEdgeInfo. Is there something obvious that I am doing wrong? Also tried using Mock instead of Spy to no avail.
Aucun commentaire:
Enregistrer un commentaire