Search in sources :

Example 1 with ScTypeDefinition

use of org.jetbrains.plugins.scala.lang.psi.api.toplevel.typedef.ScTypeDefinition in project intellij by bazelbuild.

the class BlazeScalaSpecs2TestExprConfigurationProducer method testLocation.

@Nullable
private static TestLocation testLocation(ConfigurationContext context) {
    // Handled by SM runner.
    if (!SmRunnerUtils.getSelectedSmRunnerTreeElements(context).isEmpty()) {
        return null;
    }
    ScInfixExpr testCase = Specs2Utils.getContainingTestExprOrScope(context.getPsiLocation());
    if (testCase == null) {
        return null;
    }
    ScTypeDefinition testClass = PsiTreeUtil.getParentOfType(testCase, ScTypeDefinition.class);
    if (testClass == null) {
        return null;
    }
    TestSize testSize = TestSizeAnnotationMap.getTestSize(testClass);
    TargetInfo target = RunUtil.targetForTestClass(testClass, testSize);
    if (target == null) {
        return null;
    }
    return new TestLocation(target, testClass, testCase);
}
Also used : TargetInfo(com.google.idea.blaze.base.dependencies.TargetInfo) ScInfixExpr(org.jetbrains.plugins.scala.lang.psi.api.expr.ScInfixExpr) ScTypeDefinition(org.jetbrains.plugins.scala.lang.psi.api.toplevel.typedef.ScTypeDefinition) TestSize(com.google.idea.blaze.base.dependencies.TestSize) Nullable(javax.annotation.Nullable)

Aggregations

TargetInfo (com.google.idea.blaze.base.dependencies.TargetInfo)1 TestSize (com.google.idea.blaze.base.dependencies.TestSize)1 Nullable (javax.annotation.Nullable)1 ScInfixExpr (org.jetbrains.plugins.scala.lang.psi.api.expr.ScInfixExpr)1 ScTypeDefinition (org.jetbrains.plugins.scala.lang.psi.api.toplevel.typedef.ScTypeDefinition)1