Iterator<TemplateParameter> templateParamIterator = mock(Iterator.class);
TemplateSignature templateSignature = mock(TemplateSignature.class,
Answers.RETURNS_DEEP_STUBS.get());
TemplateParameter templateParameter = mock(TemplateParameter.class,
Answers.RETURNS_DEEP_STUBS.get());
Classifier classifier = mock(Classifier.class);
when(operation.getOwnedTemplateSignature()).thenReturn(
templateSignature);
when(templateSignature.getParameters()).thenReturn(templateParams);
when(templateParams.iterator()).thenReturn(templateParamIterator);
when(templateParamIterator.hasNext()).thenReturn(true, false);
when(templateParamIterator.next()).thenReturn(templateParameter);
when(templateParameter.getOwnedParameteredElement()).thenReturn(
classifier);
when(classifier.getLabel()).thenReturn("T");
interfaceGenerator.generateMethodTemplateParams(ast, operation, md);
assertEquals("<T>void calculateAge();\n", md.toString());
}