所以,我有如下的测试:
def "test execute(inputTuple) method emits an outputTuple containing a member ObjectType
retrieved using the entity_id in inputTuple"() {
given:
Tuple inputTuple = Mock(Tuple);
List<String> objectTypeIDsEmittedByPreviousBolt = new ArrayList<String>();
objectTypeIDsEmittedByPreviousBolt.add("member");
objectTypeIDsEmittedByPreviousBolt.add("1196");
1 * inputTuple.getValues() >> objectTypeIDsEmittedByPreviousBolt;
when:
this.bolt.execute(inputTuple);
then:
1 * this.collector.emit(inputTuple, THE_OUTPUT_TUPLE);
1 * this.collector.ack(inputTuple);
}
我收到以下错误,我不明白。 是inputTuple不匹配或outputTuple不匹配?:
Too few invocations for:
1 * this.collector.emit( inputTuple, [['response':['status':'OK', ... 'member']]]]) (0 invocations)
Unmatched invocations (ordered by similarity):
1 * <OutputCollector>.emit(Mock for type 'Tuple' named 'inputTuple', [['response':['status':'OK', ...'member']]]])
at org.spockframework.mock.runtime.InteractionScope.verifyInteractions(InteractionScope.java:78)
at org.spockframework.mock.runtime.MockController.leaveScope(MockController.java:76)
at member.bolt.CallConsoleAPIToGetAllObjectTypeInfoBoltTest.test execute(inputTuple) method emits an outputTuple containing a member ObjectType retrieved using the entity_id in inputTuple(CallConsoleAPIToGetAllObjectTypeInfoBoltTest.groovy:63)