package Ġcom . anc ient light stud ios . simple gen Ċ Ċ import Ġorg . slf 4 j . LoggerFactory Ċ import Ġjava . io . File Ċ import Ġjava . nio . file . Files Ċ import Ġjava . nio . file . Path Ċ Ċ /** Ċ Ġ* ĠHelper Ġclass Ġfor Ġquickly Ġsetting Ġup Ġtest Ġfixtures Ġfor Ġintegration Ġtests . ĠIt Ġis Ġauto - clo s able Ġand Ġwill Ċ Ġ* Ġdelete Ġthe Ġtemporary Ġoutput Ġfolder Ġon Ġclose . Ċ Ġ*/ Ċ class ĠIntegration TestFixture ( configFile : ĠString ) Ġ: ĠAuto Closeable Ġ{ ĊĠĠĠ Ġprivate Ġval Ġlog Ġ= ĠLoggerFactory . getLogger ( Integration TestFixture :: class . java ) ĊĊĠĠĠ Ġprivate Ġval Ġfolder Ġ= ĊĠĠĠĠĠĠĠ ĠFile ( Integration TestFixture :: class . java . getResource ( configFile ). to URI ()). parent File ĊĠĠĠ Ġprivate Ġval Ġoutput Folder Ġ= ĊĠĠĠĠĠĠĠ ĠFiles . create Temp Directory (" Integration TestFixture ") ĊĊĠĠĠ Ġfun Ġbuild Runner () Ġ= ĊĠĠĠĠĠĠĠ ĠRunner ( folder . canonical Path , Ġoutput Folder Ġ= Ġoutput Folder . to File (). canonical Path , Ġforce Update Ġ= Ġtrue ) ĊĊĠĠĠ Ġfun Ġresolve OutputFile ( name : ĠString ): ĠFile Ġ= Ġoutput Folder . resolve ( name ). to File () ĊĊĠĠĠ Ġoverride Ġfun Ġclose () Ġ{ ĊĠĠĠĠĠĠĠ Ġlog . info (" Clean ing Ġup Ġtemporary Ġfiles Ġin Ġ'$ output Folder '") ĊĠĠĠĠĠĠĠ Ġ// Ġrecursively Ġdelete Ġthe Ġtemp Ġfolder ĊĠĠĠĠĠĠĠ ĠFiles . walk ( output Folder ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. sorted ( Comparator . reverse Order ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. map ( Path :: to File ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. forEach ( File :: delete ) ĊĠĠĠ Ġ} Ċ }