package Ġcom . compiler . server . generator Ċ Ċ import Ġcom . compiler . server . model . Execution Result Ċ import Ġcom . compiler . server . model . Project Ċ import Ġcom . compiler . server . service . Kotlin Project Executor Ċ import Ġorg . junit . jupiter . api . Assertions Ċ import Ġorg . springframework . beans . factory . annotation . Autowired Ċ import Ġorg . springframework . stereotype . Component Ċ Ċ @ Component Ċ class ĠTest Project Runner Ġ{ ĊĠ Ġ@ Autowired ĊĠ Ġprivate Ġlateinit Ġvar Ġkotlin Project Executor : ĠKotlin Project Executor ĊĊĠ Ġfun Ġrun ( code : ĠString , Ġcontains : ĠString , Ġargs : ĠString Ġ= Ġ"") : ĠExecution Result Ġ{ ĊĠĠĠ Ġval Ġproject Ġ= Ġgenerate Single Project ( text Ġ= Ġcode , Ġargs Ġ= Ġargs ) ĊĠĠĠ Ġreturn Ġrun And Test ( project , Ġcontains ) ĊĠ Ġ} ĊĊĠ Ġfun Ġmulti Run ( code : ĠList < String >, Ġcontains : ĠString ) Ġ{ ĊĠĠĠ Ġval Ġproject Ġ= Ġgenerate Multi Project (* code . to Typed Array ()) ĊĠĠĠ Ġrun And Test ( project , Ġcontains ) ĊĠ Ġ} ĊĊĠ Ġfun Ġrun With Exception ( code : ĠString , Ġcontains : ĠString ): ĠExecution Result Ġ{ ĊĠĠĠ Ġval Ġproject Ġ= Ġgenerate Single Project ( text Ġ= Ġcode ) ĊĠĠĠ Ġval Ġresult Ġ= Ġkotlin Project Executor . run ( project ) ĊĠĠĠ ĠAssertions . assertNotNull ( result . exception , Ġ" Test Ġresult Ġshould Ġno Ġbe Ġa Ġnull ") ĊĠĠĠ ĠAssertions . assertTrue ( ĊĠĠĠĠĠ Ġresult . exception ?. fullName ?. contains ( contains ) Ġ== Ġtrue , ĊĠĠĠĠĠ Ġ" Actual : Ġ${ result . exception ?. message }, ĠExpected : Ġ$ contains " ĊĠĠĠ Ġ) ĊĠĠĠ Ġreturn Ġresult ĊĠ Ġ} ĊĊĠ Ġfun Ġget Version () Ġ= Ġkotlin Project Executor . getVersion (). version ĊĊĠ Ġprivate Ġfun Ġrun And Test ( project : ĠProject , Ġcontains : ĠString ): ĠExecution Result Ġ{ ĊĠĠĠ Ġval Ġresult Ġ= Ġkotlin Project Executor . run ( project ) ĊĠĠĠ ĠAssertions . assertNotNull ( result , Ġ" Test Ġresult Ġshould Ġno Ġbe Ġa Ġnull ") ĊĠĠĠ ĠAssertions . assertTrue ( result . text . contains ( contains ), Ġ""" ĊĠĠĠĠĠ ĠActual : Ġ${ result . text } ĠĊĠĠĠĠĠ ĠExpected : Ġ$ contains ĠĠĠĠĠĠĠ ĊĠĠĠĠĠ ĠResult : Ġ${ result . errors } ĊĠĠĠ Ġ""" . trim Indent ()) ĊĠĠĠ Ġreturn Ġresult ĊĠ Ġ} Ċ }