void () { myFixture.addClass("public interface MyCallback {}"); myFixture.addClass(""" final class MyUtils { public static void doSomethingWithCallback(MyCallback cb) { } } """); myFixture.configureByText("a.java", "\nclass Outer {\n static class Inner implements MyCallback {\n void aMethod() {\n <caret>\n }\n }\n}\n"); Template template = getTemplateManager().createTemplate("myCbDo", "user", "MyUtils.doSomethingWithCallback($CB$)"); MacroCallNode call = new MacroCallNode(new VariableOfTypeMacro()); call.addParameter(new ConstantNode("MyCallback")); template.addVariable("CB", call, new EmptyNode(), false); startTemplate(template); myFixture.checkResult( """ class Outer { static class Inner implements MyCallback { void aMethod() { MyUtils.doSomethingWithCallback(this) } } } """); }