// ĠCopyright Ġ 2 0 0 0 - 2 0 1 8 Ġ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 . Ċ package Ġorg . jetbrains . plugins . gradle . execution . test . runner Ċ Ċ import Ġcom . intellij . execution . Location Ċ import Ġcom . intellij . execution . Psi Location Ċ import Ġcom . intellij . execution . actions . Configuration Context Ċ import Ġcom . intellij . execution . junit 2 . Psi Member Parameterized Location Ċ import Ġcom . intellij . openapi . action System . Action Places Ċ import Ġcom . intellij . openapi . action System . Lang Data Keys Ċ import Ġcom . intellij . openapi . application . Application Manager Ċ import Ġcom . intellij . openapi . module . Module Util Core Ċ import Ġcom . intellij . openapi . util . Comp utable Ċ import Ġcom . intellij . psi . Java Psi Facade Ċ import Ġcom . intellij . psi . Psi Class Ċ import Ġcom . intellij . psi . Psi Element Ċ import Ġcom . intellij . psi . Psi Method Ċ import Ġcom . intellij . psi . impl . Psi Class Impl Util Ċ import Ġcom . intellij . psi . search . Global Search Scope Ċ import Ġcom . intellij . test Framework . Map DataContext Ċ import Ġorg . jetbrains . plugins . gradle . import ing . Gradle Import ing TestCase Ċ import Ġorg . jetbrains . plugins . gradle . service . execution . Gradle Run Configuration Ċ import Ġorg . junit . runners . Parameterized Ċ Ċ abstract Ġclass ĠGradle Configuration Producer TestCase Ġ: ĠGradle Import ing TestCase () Ġ{ ĊĊĠ Ġprotected Ġfun Ġassert Test Filter ( className : ĠString , ĠmethodName : ĠString ?, Ġtest Filter : ĠString ) Ġ{ ĊĠĠĠ Ġval Ġlocation Provider Ġ= Ġ{ Ġc : ĠPsi Class ?, Ġm : ĠPsi Method ? Ġ-> ĠPsi Location . from Psi Element (( m Ġ?: Ġc ) Ġas ĠPsi Element ?) Ġ} ĊĠĠĠ Ġval Ġconfigurations Ġ= Ġget Configurations ( className , ĠmethodName , Ġlocation Provider ) ĊĠĠĠ Ġassert Size ( 1 , Ġconfigurations ) ĊĠĠĠ Ġval Ġexecution Settings Ġ= Ġconfigurations . first (). settings ĊĠĠĠ ĠassertEquals ( test Filter , Ġexecution Settings . toString ()) ĊĠ Ġ} ĊĊĠ Ġprotected Ġfun Ġassert Parameterized Location Test Filter ( className : ĠString , ĠmethodName : ĠString ?, Ġparam SetName : ĠString , Ġtest Filter : ĠString ) Ġ{ ĊĠĠĠ Ġval Ġlocation Provider Ġ= Ġ{ Ġc : ĠPsi Class ?, Ġm : ĠPsi Method ? Ġ-> ĠPsi Member Parameterized Location ( my Project , Ġm !! , Ġc , Ġparam SetName ) Ġ} ĊĠĠĠ Ġval Ġconfigurations Ġ= Ġget Configurations ( className , ĠmethodName , Ġlocation Provider ) ĊĠĠĠ Ġassert Size ( 1 , Ġconfigurations ) ĊĠĠĠ Ġval Ġexecution Settings Ġ= Ġconfigurations . first (). settings ĊĠĠĠ ĠassertEquals ( test Filter , Ġexecution Settings . toString ()) ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġget Configurations ( className : ĠString , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠmethodName : ĠString ?, ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġlocation Provider : Ġ( Psi Class ?, ĠPsi Method ?) Ġ-> ĠLocation < *> ĊĠ Ġ): ĠList < Gradle Run Configuration > Ġ{ ĊĠĠĠ Ġreturn ĠApplication Manager . getApplication (). run Read Action ( Comp utable Ġ{ ĊĠĠĠĠĠ Ġval Ġclazz Ġ= ĠJava Psi Facade . getInstance ( my Project ). find Class ( className , ĠGlobal Search Scope . all Scope ( my Project )) ĊĠĠĠĠĠ Ġval Ġmethod Ġ= Ġif Ġ( methodName Ġ!= Ġnull ) ĠPsi Class Impl Util . find Methods ByName ( clazz !! , ĠmethodName , Ġfalse ). first () Ġelse Ġnull ĊĠĠĠĠĠ Ġval Ġdata Context Ġ= ĠMap DataContext (). apply Ġ{ ĊĠĠĠĠĠĠĠ Ġput ( Lang Data Keys . PROJECT , Ġmy Project ) ĊĠĠĠĠĠĠĠ Ġput ( Lang Data Keys . MODULE , ĠModule Util Core . find Module For Psi Element ( clazz !! )) ĊĠĠĠĠĠĠĠ Ġput ( Location . DATA _ KEY , Ġlocation Provider ( clazz , Ġmethod )) ĊĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠ ĠConfiguration Context . get From Context ( data Context , ĠAction Places . UNKNOWN ). configurations From Context ĊĠĠĠĠĠĠĠ Ġ? . filter Ġ{ Ġit . configuration Ġis ĠGradle Run Configuration Ġ} ĊĠĠĠĠĠĠĠ Ġ? . map Ġ{ Ġconfiguration From Context Ġ-> Ġconfiguration From Context . configuration Ġas ĠGradle Run Configuration Ġ} ĊĠĠĠĠĠ Ġ?: Ġempty List () ĊĠĠĠ Ġ}) ĊĠ Ġ} ĊĊĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠIt 's Ġsufficient Ġto Ġrun Ġthe Ġtest Ġagainst Ġone Ġgradle Ġversion ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġ@ Parameterized . Parameters ( name Ġ= Ġ" with ĠGradle -{ 0 }") ĊĠĠĠ Ġ@ Jvm Static ĊĠĠĠ Ġfun Ġtests (): ĠCollection < Array < out ĠString >> Ġ= Ġarray ListOf ( array Of ( BASE _ GRAD LE _ VERSION )) ĊĠ Ġ} Ċ }