コード例 #1
0
 private void doTest() throws IOException {
   myFixture.configureByFile(getFileName());
   List<String> directives =
       InTextDirectivesUtils.findListWithPrefixes(
           FileUtil.loadFile(new File(getPathToFile())), "// ANNOTATION: ");
   assertFalse("Specify ANNOTATION directive in test file", directives.isEmpty());
   String annotationClassName = directives.get(0);
   PsiClass psiClass = getPsiClass(annotationClassName);
   checkResult(AnnotatedMembersSearch.search(psiClass, getProjectScope()));
 }
コード例 #2
0
 private void doJUnit3test() throws IOException {
   myFixture.configureByFile(getFileName());
   List<String> directives =
       InTextDirectivesUtils.findListWithPrefix(
           "// CLASS: ", FileUtil.loadFile(new File(getPathToFile())));
   assertFalse("Specify CLASS directive in test file", directives.isEmpty());
   String superClassName = directives.get(0);
   PsiClass psiClass = getPsiClass(superClassName);
   checkResult(ClassInheritorsSearch.search(psiClass, getProjectScope(), false));
 }
コード例 #3
0
  private void doTestAction(@NotNull String cutOrCopy, String path) throws Exception {
    myFixture.setTestDataPath(BASE_PATH);
    File testFile = new File(path);
    String testFileName = testFile.getName();

    configureByDependencyIfExists(testFileName.replace(".kt", ".dependency.kt"));
    configureByDependencyIfExists(testFileName.replace(".kt", ".dependency.java"));
    myFixture.configureByFile(testFileName);
    myFixture.performEditorAction(cutOrCopy);

    String toFileName = testFileName.replace(".kt", ".to.kt");
    JetFile toFile = configureToFile(toFileName);
    performNotWriteEditorAction(IdeActions.ACTION_PASTE);

    myFixture.checkResultByFile(testFileName.replace(".kt", ".expected.kt"));

    if (!InTextDirectivesUtils.isDirectiveDefined(
        FileUtil.loadFile(testFile, true), ALLOW_UNRESOLVED_DIRECTIVE)) {
      checkNoUnresolvedReferences(toFile);
    }
  }