import org.jetbrains.annotations.NotNull;
public class ErlangUnitTestMethodAction extends CodeInsightAction implements CodeInsightActionHandler {
private static void insertTestFunction(@NotNull Project project, @NotNull Editor editor, String name, boolean needNewline) {
Template template = TemplateManager.getInstance(project).createTemplate("", "");
Expression nameExpr = new ConstantNode(name);
Expression expected = new ConstantNode("expected");
Expression expr = new ConstantNode("expr");
template.addTextSegment("\n" + (needNewline ? "\n" : ""));
template.addVariable("name", nameExpr, nameExpr, true);
template.addTextSegment("_test() ->\n");
template.addTextSegment("?assertEqual(");
template.addVariable(expected, true);