package Ġnet . tw ister rob . gradle . test Ċ Ċ import Ġorg . gradle . test kit . runner . Build Result Ċ import Ġorg . gradle . test kit . runner . Task Outcome Ċ import Ġorg . gradle . test kit . runner . Task Outcome . FAILED Ċ import Ġorg . gradle . test kit . runner . Task Outcome . FROM _ CACHE Ċ import Ġorg . gradle . test kit . runner . Task Outcome . NO _ SOURCE Ċ import Ġorg . gradle . test kit . runner . Task Outcome . SKIP PED Ċ import Ġorg . gradle . test kit . runner . Task Outcome . SUCCESS Ċ import Ġorg . gradle . test kit . runner . Task Outcome . UP _ TO _ DATE Ċ import Ġorg . junit . jupiter . api . Assertions . assertEquals Ċ import Ġorg . junit . jupiter . api . Assertions . assertNotNull Ċ import Ġorg . junit . jupiter . api . Assertions . assertNull Ċ import Ġorg . junit . jupiter . api . Assertions . assertTrue Ċ import Ġorg . junit . runners . model . Statement Ċ import Ġjava . io . File Ċ import Ġjava . util . Date Ċ Ċ val ĠGradle Runner Rule . root : ĠFile Ċ ĉ get () Ġ= Ġthis . settings File . parent File !! Ċ Ċ fun ĠGradle Runner Rule . project File ( relative : ĠString ): ĠFile Ġ= Ċ ĉ this . runner . project Dir . resolve ( relative ) Ċ Ċ fun ĠGradle Runner Rule . delete ( path : ĠString ) Ġ{ Ċ ĉ val Ġfile Ġ= Ġroot . resolve ( path ) Ċ ĉ assertTrue ( Ċĉ ĉ file . delete Re cursively (), Ċĉ ĉ " Cannot Ġdelete Ġ$ path \ n ${ file . describe () }" Ċ ĉ ) Ċ } Ċ Ċ fun ĠGradle Runner Rule . move ( from : ĠString , Ġto : ĠString ) Ġ{ Ċ ĉ val Ġfrom File Ġ= Ġroot . resolve ( from ) Ċ ĉ val Ġto File Ġ= Ġroot . resolve ( to ) Ċ ĉ assertTrue ( Ċĉ ĉ to File . parent File . isDirectory Ġ|| Ġto File . parent File . mkdir s (), Ċĉ ĉ " Cannot Ġcreate Ġfolder : Ġ${ to File . parent File . describe () }" Ċ ĉ ) Ċ ĉ assertTrue ( Ċĉ ĉ from File . rename To ( to File ), Ċĉ ĉ " Cannot Ġmove Ġ$ from Ġto Ġ$ to \ n ${ from File . describe () }\ n ${ to File . describe () }" Ċ ĉ ) Ċ } Ċ Ċ private Ġfun ĠFile . describe (): ĠString Ġ= Ċ ĉ absolute Path Ġ+ Ċĉĉ ĉ ", Ġstat =${ type () Ġ+ Ġchmod () }" Ġ+ Ċĉĉ ĉ ", Ġsize =${ length () }" Ġ+ Ċĉĉ ĉ ", Ġdate =${ Date ( this . lastModified ()) }" Ċ Ċ private Ġfun ĠFile . chmod (): ĠString Ġ= Ċ ĉ build String Ġ{ Ċĉ ĉ append ( if Ġ( can Read ()) Ġ" r " Ġelse Ġ"- ") Ċĉ ĉ append ( if Ġ( can Write ()) Ġ" w " Ġelse Ġ"- ") Ċĉ ĉ append ( if Ġ( can Execute ()) Ġ" x " Ġelse Ġ"- ") Ċ ĉ } Ċ Ċ private Ġfun ĠFile . type (): ĠString Ġ= Ċ ĉ when Ġ{ Ċĉ ĉ isFile Ġ-> Ġ" f " Ċĉ ĉ isDirectory Ġ-> Ġ" d " Ċĉ ĉ exists () Ġ-> Ġ" e " Ċĉ ĉ else Ġ-> Ġ" !" Ċ ĉ } Ċ Ċ fun ĠBuild Result . assert No Task ( task Path : ĠString ) Ġ{ Ċ ĉ assertNull ( task ( task Path )) Ċ } Ċ Ċ /** Ċ Ġ* ĠAssert Ġthat Ġthe Ġtask Ġexists Ġand Ġthat Ġit Ġran Ġto Ġcompletion Ġwith Ġsuccess . Ċ Ġ* ĠNote : Ġthis Ġmeans Ġthat Ġ[ Task Outcome . UP _ TO _ DATE ] Ġand Ġ[ Task Outcome . NO _ SOURCE ] Ġis Ġnot Ġ" success " ! Ċ Ġ*/ Ċ fun ĠBuild Result . assert Success ( task Path : ĠString ) Ġ{ Ċ ĉ assert Outcome ( task Path , ĠSUCCESS ) Ċ } Ċ Ċ fun ĠBuild Result . assert Failed ( task Path : ĠString ) Ġ{ Ċ ĉ assert Outcome ( task Path , ĠFAILED ) Ċ } Ċ Ċ fun ĠBuild Result . assert Skipped ( task Path : ĠString ) Ġ{ Ċ ĉ assert Outcome ( task Path , ĠSKIP PED ) Ċ } Ċ Ċ fun ĠBuild Result . assert Up ToDate ( task Path : ĠString ) Ġ{ Ċ ĉ assert Outcome ( task Path , ĠUP _ TO _ DATE ) Ċ } Ċ Ċ fun ĠBuild Result . assert From Cache ( task Path : ĠString ) Ġ{ Ċ ĉ assert Outcome ( task Path , ĠFROM _ CACHE ) Ċ } Ċ Ċ fun ĠBuild Result . assert No Source ( task Path : ĠString ) Ġ{ Ċ ĉ assert Outcome ( task Path , ĠNO _ SOURCE ) Ċ } Ċ Ċ fun ĠBuild Result . assert Outcome ( task Path : ĠString , Ġoutcome : ĠTask Outcome ) Ġ{ Ċ ĉ val Ġtask Ġ= Ġtask ( task Path ) Ċĉ ĉ . let Ġ{ ĠassertNotNull ( it , Ġ"${ task Path } Ġtask Ġnot Ġfound "); Ġit !! Ġ} Ċ ĉ assertEquals ( outcome , Ġtask . outcome ) Ċ } Ċ Ċ /** Ċ Ġ* ĠHelper Ġto Ġallow ĠSAM - like Ġbehavior Ġfor Ġ[ Statement ] Ġabstract Ġclass . Ċ Ġ*/ Ċ @ Suppress (" Test FunctionName ") Ċ inline Ġfun ĠStatement ( cross inline Ġblock : Ġ() Ġ-> ĠUnit ): ĠStatement Ġ= Ċ ĉ object Ġ: ĠStatement () Ġ{ Ċĉ ĉ override Ġfun Ġevaluate () Ġ{ Ċĉĉ ĉ block () Ċĉ ĉ } Ċ ĉ } Ċ Ċ /** Ċ Ġ* ĠSee Ġunit Ġtests Ġfor Ġexamples . Ċ Ġ*/ Ċ fun Ġtasks In ( modules : ĠArray < String >, Ġvar arg Ġtask Names : ĠString ): ĠArray < String > Ġ= Ċ ĉ modules Ċĉ ĉ . flatMap Ġ{ ĠmoduleName Ġ-> Ċĉĉ ĉ require ( moduleName Ġ!= Ġ"") Ġ{ Ġ" Invalid Ġmodule " Ġ} Ċĉĉ ĉ val Ġseparator Ġ= Ġif Ġ( moduleName Ġ== Ġ": ") Ġ"" Ġelse Ġ":" Ċĉĉ ĉ task Names . map Ġ{ Ġtask Name Ġ-> Ċĉĉĉ ĉ require ( task Name Ġ!= Ġ"") Ġ{ Ġ" Invalid Ġtask " Ġ} Ċĉĉĉ ĉ "${ moduleName }${ separator }${ task Name }" Ċĉĉ ĉ } Ċĉ ĉ } Ċĉ ĉ . to Typed Array () Ċ Ċ inline Ġoperator Ġfun Ġ< re ified ĠT > ĠArray < T >. minus ( others : ĠArray < T >): ĠArray < T > Ġ= Ċ ĉ ( this . toList () Ġ- Ġ@ Suppress (" Convert Argument To Set ") Ġothers ). to Typed Array () Ċ