• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java JavaCodeInsightTestFixture类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture的典型用法代码示例。如果您正苦于以下问题:Java JavaCodeInsightTestFixture类的具体用法?Java JavaCodeInsightTestFixture怎么用?Java JavaCodeInsightTestFixture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



JavaCodeInsightTestFixture类属于com.intellij.testFramework.fixtures包,在下文中一共展示了JavaCodeInsightTestFixture类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: addLibrary

import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture; //导入依赖的package包/类
public static void addLibrary(@NotNull JavaCodeInsightTestFixture parent, Module module, String libName, String libPath, String jarArr) {
    Disposable projectDisposable;
    try {
//      projectDisposable = parent.getTestRootDisposable();
      final MethodHandle methodHandle = MethodHandles.lookup().findVirtual(JavaCodeInsightTestFixture.class, "getProjectDisposable", MethodType.methodType(Disposable.class));
      projectDisposable = (Disposable) methodHandle.invoke(parent);
    } catch (Throwable throwable) {
      projectDisposable = null;
    }

    if (null == projectDisposable) {
      PsiTestUtil.addLibrary(module, libName, libPath, jarArr);
    } else {
      addLibrary(projectDisposable, module, libName, libPath, jarArr);
    }
  }
 
开发者ID:mplushnikov,项目名称:lombok-intellij-plugin,代码行数:17,代码来源:TestUtil.java


示例2: addJavaClassTo

import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture; //导入依赖的package包/类
static PsiClass addJavaClassTo(JavaCodeInsightTestFixture fixture) throws IOException {
    return fixture.addClass("package my.pack; " +
            "   public class MyClass {" +
            "       public int xField1;" +

            "       private int prop1;" +
            "       public int getProp1() { return prop1; }" +
            "       public void setProp1(int prop1) { this.prop1 = prop1; }" +

            "       private int prop2;" +
            "       public int getProp2() { return prop2; }" +

            "       public MyClass getPropObject() { return this; }" +

            "       private int prop3;" +
            "       public void setProp3(int prop3) { this.prop3 = prop3; }" +

            "       public static void meth1() { ; }" +
            "       public MyClass returnObj() { return this; }" +
            "   }");
}
 
开发者ID:consulo,项目名称:consulo-apache-velocity,代码行数:22,代码来源:Util.java


示例3: addJavaxDefaultNullabilityAnnotations

import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture; //导入依赖的package包/类
public static void addJavaxDefaultNullabilityAnnotations(final JavaCodeInsightTestFixture fixture) {
  fixture.addClass("package javax.annotation;" +
                   "@javax.annotation.meta.TypeQualifierDefault(java.lang.annotation.ElementType.PARAMETER) @javax.annotation.Nonnull " +
                   "public @interface ParametersAreNonnullByDefault {}");
  fixture.addClass("package javax.annotation;" +
                   "@javax.annotation.meta.TypeQualifierDefault(java.lang.annotation.ElementType.PARAMETER) @javax.annotation.Nullable " +
                   "public @interface ParametersAreNullableByDefault {}");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:DataFlowInspectionTest.java


示例4: addJavaxNullabilityAnnotations

import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture; //导入依赖的package包/类
public static void addJavaxNullabilityAnnotations(final JavaCodeInsightTestFixture fixture) {
  fixture.addClass("package javax.annotation;" +
                   "public @interface Nonnull {}");
  fixture.addClass("package javax.annotation;" +
                   "public @interface Nullable {}");
  fixture.addClass("package javax.annotation.meta;" +
                   "public @interface TypeQualifierDefault { java.lang.annotation.ElementType[] value() default {};}");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:DataFlowInspectionTest.java


示例5: getRootStub

import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture; //导入依赖的package包/类
public static ElementStub getRootStub(@TestDataFile String filePath, JavaCodeInsightTestFixture fixture) {
  PsiFile psiFile = fixture.configureByFile(filePath);

  StubTreeLoader loader = StubTreeLoader.getInstance();
  VirtualFile file = psiFile.getVirtualFile();
  assertTrue(loader.canHaveStub(file));
  ObjectStubTree stubTree = loader.readFromVFile(fixture.getProject(), file);
  assertNotNull(stubTree);
  ElementStub root = (ElementStub)stubTree.getRoot();
  assertNotNull(root);
  return root;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:DomStubTest.java


示例6: findUsages

import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture; //导入依赖的package包/类
private static Collection<UsageInfo> findUsages(String fileName, final JavaCodeInsightTestFixture fixture, String newFilePath)
  throws Throwable {
  VirtualFile file = fixture.copyFileToProject(BASE_PATH + fileName, newFilePath);
  fixture.configureFromExistingVirtualFile(file);

  final UsageTarget[] targets = UsageTargetUtil.findUsageTargets(new DataProvider() {
    @Override
    public Object getData(@NonNls String dataId) {
      return ((EditorEx)fixture.getEditor()).getDataContext().getData(dataId);
    }
  });

  assert targets != null && targets.length > 0 && targets[0] instanceof PsiElementUsageTarget;
  return fixture.findUsages(((PsiElementUsageTarget)targets[0]).getElement());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:AndroidFindUsagesTest.java


示例7: checkCompletionContains

import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture; //导入依赖的package包/类
public static void checkCompletionContains(JavaCodeInsightTestFixture fixture, String ... expectedVariants) {
  LookupElement[] lookupElements = fixture.completeBasic();

  Assert.assertNotNull(lookupElements);

  Set<String> missedVariants = ContainerUtil.newHashSet(expectedVariants);

  for (LookupElement lookupElement : lookupElements) {
    String lookupString = lookupElement.getLookupString();
    missedVariants.remove(lookupString);

    Object object = lookupElement.getObject();
    if (object instanceof ResolveResult) {
      object = ((ResolveResult)object).getElement();
    }

    if (object instanceof PsiMethod) {
      missedVariants.remove(lookupString + "()");
    }
    else if (object instanceof PsiVariable) {
      missedVariants.remove('@' + lookupString);
    }
    else if (object instanceof NamedArgumentDescriptor) {
      missedVariants.remove(lookupString + ':');
    }
  }

  if (missedVariants.size() > 0) {
    Assert.assertTrue("Some completion variants are missed " + missedVariants, false);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:TestUtils.java


示例8: getRootStub

import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture; //导入依赖的package包/类
public static ElementStub getRootStub(String filePath, JavaCodeInsightTestFixture fixture) {
  PsiFile psiFile = fixture.configureByFile(filePath);

  StubTreeLoader loader = StubTreeLoader.getInstance();
  VirtualFile file = psiFile.getVirtualFile();
  assertTrue(loader.canHaveStub(file));
  ObjectStubTree stubTree = loader.readFromVFile(fixture.getProject(), file);
  assertNotNull(stubTree);
  ElementStub root = (ElementStub)stubTree.getRoot();
  assertNotNull(root);
  return root;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:13,代码来源:DomStubTest.java


示例9: addJavaSubclassTo

import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture; //导入依赖的package包/类
static PsiClass addJavaSubclassTo(JavaCodeInsightTestFixture fixture) throws IOException {
    addJavaClassTo(fixture);
    return fixture.addClass("package my.pack; " +
            "   public class Subclass extends MyClass {" +
            "       protected void meth12() { ; }" +
            "       void meth13() { ; }" +
            "       private void meth14() { ; }" +
            "       public void meth11() { ; }" +
            "   }");
}
 
开发者ID:consulo,项目名称:consulo-apache-velocity,代码行数:11,代码来源:Util.java


示例10: addJavaClassWithInnerClassTo

import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture; //导入依赖的package包/类
static PsiClass addJavaClassWithInnerClassTo(JavaCodeInsightTestFixture fixture) throws IOException {
    return fixture.addClass("package my.pack; " +
            "   public class Class2 {" +
            "       public void meth11() { ; }" +
            "       public class InnerClass { } " +
            "       public interface InnerInterface { } " +
            "   }");
}
 
开发者ID:consulo,项目名称:consulo-apache-velocity,代码行数:9,代码来源:Util.java


示例11: addJavaInterfaceWithOverloadedMethodTo

import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture; //导入依赖的package包/类
static PsiClass addJavaInterfaceWithOverloadedMethodTo(JavaCodeInsightTestFixture fixture) throws IOException {
    fixture.addClass("package java.lang; public @interface Deprecated {}");
    return fixture.addClass("package my.pack; " +
            "public interface SomeInterface {" +
            "  public void foo();" +
            "  public void foo(int a);" +
            "  public void foo(String a);" +
            "  public void foo(String a, int b);" +
            "  @Deprecated public void foo(int a, String b);" +
            "  public void foo(String a, String b, String c);" +
            "  public int[] getNumbers();" +
            "}");
}
 
开发者ID:consulo,项目名称:consulo-apache-velocity,代码行数:14,代码来源:Util.java


示例12: addJavaClassWith3Getters

import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture; //导入依赖的package包/类
static PsiClass addJavaClassWith3Getters(JavaCodeInsightTestFixture fixture) throws IOException {
    return fixture.addClass("package my.pack; " +
            "public class GetterOwner {" +
            "  public Object getlowerCase() { return null;}" +
            "  public Object getLowerCase() { return null;}" +
            "  public Object get(String s) { return s;}" +
            "}");
}
 
开发者ID:consulo,项目名称:consulo-apache-velocity,代码行数:9,代码来源:Util.java


示例13: addJavaClassWith2Getters

import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture; //导入依赖的package包/类
static PsiClass addJavaClassWith2Getters(JavaCodeInsightTestFixture fixture) throws IOException {
    return fixture.addClass("package my.pack; " +
            "public class GetterOwner {" +
            "  public Object getUpperCase() { return null;}" +
            "  public Object get(String s) { return s;}" +
            "}");
}
 
开发者ID:consulo,项目名称:consulo-apache-velocity,代码行数:8,代码来源:Util.java


示例14: AutoValuePluginTestUtils

import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture; //导入依赖的package包/类
public AutoValuePluginTestUtils(JavaCodeInsightTestFixture myFixture) {
    this.myFixture = myFixture;
}
 
开发者ID:afcastano,项目名称:AutoValuePlugin,代码行数:4,代码来源:AutoValuePluginTestUtils.java


示例15: addEmptyJavaClassTo

import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture; //导入依赖的package包/类
static PsiClass addEmptyJavaClassTo(JavaCodeInsightTestFixture fixture) throws IOException {
    return fixture.addClass("package foo; public class Bar {}");
}
 
开发者ID:consulo,项目名称:consulo-apache-velocity,代码行数:4,代码来源:Util.java


示例16: createCodeInsightFixture

import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture; //导入依赖的package包/类
@Override
public JavaCodeInsightTestFixture createCodeInsightFixture(IdeaProjectTestFixture projectFixture) {
  return new JavaCodeInsightTestFixtureImpl(projectFixture, new TempDirTestFixtureImpl());
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:5,代码来源:JavaTestFixtureFactoryImpl.java



注:本文中的com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SelectEditPartTracker类代码示例发布时间:2022-05-23
下一篇:
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap