void (String tag) { String baseName = getBaseName("tag"); myFixture.configureByFile(baseName + ".html"); List<AnAction> actions = SurroundWithHandler.buildSurroundActions(getProject(), myFixture.getEditor(), myFixture.getFile(), null); Optional<InvokeTemplateAction> surroundWithTagAction = actions.stream() .filter(it -> it instanceof InvokeTemplateAction) .map(it -> (InvokeTemplateAction) it) .filter(it -> it.getTemplateText().toLowerCase(Locale.ROOT).contains("surround with <tag>")) .findFirst(); assertTrue(surroundWithTagAction.isPresent()); surroundWithTagAction.get().perform(); myFixture.type(tag); myFixture.checkResultByFile(baseName + "_after.html"); }