@@ -0,0 +1,2501 @@
+// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.%0Apackage com.intellij.ide.fileTemplates;%0A%0Aimport com.intellij.platform.templates.SaveProjectAsTemplateAction;%0Aimport com.intellij.testFramework.PlatformTestUtil;%0Aimport com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;%0Aimport gnu.trove.TIntObjectHashMap;%0A%0Aimport java.util.regex.Matcher;%0Aimport java.util.regex.Pattern;%0A%0A/**%0A * @author Dmitry Avdeev%0A */%0Apublic class FileTemplatesProcessingTest extends LightPlatformCodeInsightFixtureTestCase %7B%0A  @Override%0A  protected void setUp() throws Exception %7B%0A    super.setUp();%0A    PlatformTestUtil.setLongMeaninglessFileIncludeTemplateTemporarilyFor(getProject(), getTestRootDisposable());%0A  %7D%0A%0A  public void testExtractTemplate() %7B%0A    doTest(true, %22/** Special Velocity symbols # and $ should be escaped */%5Cn%22 +%0A                 %22%5Cn%22 +%0A                 %22/**%5Cn%22 +%0A                 %22 * Created by Dmitry.Avdeev on 1/22/13.%5Cn%22 +%0A                 %22 */%5Cn%22 +%0A                 %22public class Bar %7B%5Cn%22 +%0A                 %22%7D%22,%0A           %22/** Special Velocity symbols %5C%5C# and %5C%5C$ should be escaped */%5Cn%22 +%0A           %22%5Cn%22 +%0A           %22/**%5Cn%22 +%0A           %22 * Created by $%7BUSER%7D on $%7BDATE%7D.%5Cn%22 +%0A           %22 */%5Cn%22 +%0A           %22%5Cn%22 +%0A           %22public class Bar %7B%5Cn%22 +%0A           %22%7D%22);%0A  %7D%0A%0A  private void doTest(boolean shouldEscape, String input, String expected) %7B%0A    FileTemplate template = FileTemplateManager.getInstance(getProject()).getDefaultTemplate(FileTemplateManager.FILE_HEADER_TEMPLATE_NAME);%0A    Pattern pattern = FileTemplateUtil.getTemplatePattern(template, getProject(), new TIntObjectHashMap%3C%3E());%0A    Matcher matcher = pattern.matcher(input);%0A    assertTrue(matcher.matches());%0A    String result = SaveProjectAsTemplateAction.convertTemplates(input, pattern, template.getText(), shouldEscape);%0A    assertEquals(expected, result);%0A  %7D%0A%0A  public void testExtractTemplateUnescaped() %7B%0A    doTest(false, %22/** Special Velocity symbols # and $ should not be escaped */%5Cn%22 +%0A                  %22%5Cn%22 +%0A                  %22/**%5Cn%22 +%0A                  %22 * Created by Dmitry.Avdeev on 1/22/13.%5Cn%22 +%0A                  %22 */%5Cn%22 +%0A                  %22public class Bar %7B%5Cn%22 +%0A                  %22%7D%22,%0A           %22/** Special Velocity symbols # and $ should not be escaped */%5Cn%22 +%0A           %22%5Cn%22 +%0A           %22%3CIntelliJ_File_Header%3E%5Cn%22 +%0A           %22public class Bar %7B%5Cn%22 +%0A           %22%7D%22);%0A  %7D%0A%7D%0A

move tests for facets into the community project