package Ġnet . ser en ity bdd . reports . model Ċ Ċ import Ġnet . th uc yd ides . core . reports . Outcome Format Ċ import Ġnet . th uc yd ides . core . reports . Test Outcome Loader Ċ import Ġnet . th uc yd ides . core . reports . Test Outcome s Ċ import Ġnet . th uc yd ides . core . util . Mock Environment Variables Ċ import Ġorg . assertj . core . api . Assertions . assertThat Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġorg . junit . jupiter . api . Test Instance Ċ import Ġjava . nio . file . Paths Ċ Ċ @ Test Instance ( Test Instance . Lifecycle . PER _ CLASS ) Ċ class ĠWhen Calcul ating Duration Dist ributions Ġ{ ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` default Ġdur ations Ġshould Ġbe Ġdefined `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġenvironment Variables Ġ= ĠMock Environment Variables () ĊĠĠĠĠĠĠĠ Ġval Ġtest Outcome s Ġ= Ġtest Outcome s In ("/ test _ outcome s / with _ var ied _ dur ations ") ĊĊĠĠĠĠĠĠĠ Ġval Ġdistribution Ġ= ĠDuration Distribution ( environment Variables , Ġtest Outcome s ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( distribution . get Bucket Labels ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isEqualTo (" [' Under Ġ 1 Ġsecond ',' 1 Ġto Ġ 1 0 Ġseconds ',' 1 0 Ġto Ġ 3 0 Ġseconds ',' 3 0 Ġto Ġ 6 0 Ġseconds ',' 1 Ġto Ġ 2 Ġminutes ',' 2 Ġto Ġ 5 Ġminutes ',' 5 Ġto Ġ 1 0 Ġminutes ',' 1 0 Ġminutes Ġor Ġover '] ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` tests Ġshould Ġbe Ġdistributed Ġac ro os Ġthe Ġduration Ġbuckets `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġenvironment Variables Ġ= ĠMock Environment Variables () ĊĠĠĠĠĠĠĠ Ġenvironment Variables . setProperty (" ser en ity . report . dur ations "," 1 , 2 , 4 , 8 , 1 0 , 2 0 ") ĊĠĠĠĠĠĠĠ Ġval Ġtest Outcome s Ġ= Ġtest Outcome s In ("/ test _ outcome s / with _ var ied _ dur ations ") ĊĊĠĠĠĠĠĠĠ Ġval Ġdistribution Ġ= ĠDuration Distribution ( environment Variables , Ġtest Outcome s ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( distribution . getNumberOf Tests Per Duration ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isEqualTo (" [' 1 2 ',' 1 0 ',' 2 ',' 9 ',' 2 ',' 3 ',' 0 '] ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġtest Outcome s In ( directory : ĠString ) Ġ: ĠTest Outcome s Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġoutcome Dir Ġ= ĠPaths . get ( java Class . getResource ( directory ). to URI ()). to File () ĊĠĠĠĠĠĠĠ Ġreturn ĠTest Outcome Loader . load Test Outcome s (). in Format ( Outcome Format . JSON ). from ( outcome Dir ); ĊĠĠĠ Ġ} Ċ }