package Ġuk . gov . just ice . digital . h mp ps . indexer . model Ċ Ċ import Ġorg . assertj . core . api . Assertions . assertThat Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġuk . gov . just ice . digital . h mp ps . indexer . model . Index State . AB SENT Ċ import Ġuk . gov . just ice . digital . h mp ps . indexer . model . Index State . BUILD ING Ċ import Ġuk . gov . just ice . digital . h mp ps . indexer . model . Index State . CANCEL LED Ċ import Ġuk . gov . just ice . digital . h mp ps . indexer . model . Index State . COMPLETED Ċ import Ġuk . gov . just ice . digital . h mp ps . indexer . model . Sync Index . BLUE Ċ import Ġuk . gov . just ice . digital . h mp ps . indexer . model . Sync Index . GREEN Ċ import Ġjava . time . LocalDateTime Ċ Ċ internal Ġclass ĠIndex Status Test Ġ{ ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` will Ġswitch Ġindexes `() Ġ{ ĊĠĠĠ Ġval Ġold StartTime Ġ= ĠLocalDateTime . now (). minus Hours ( 2 4 ) ĊĠĠĠ Ġval Ġold EndTime Ġ= Ġold StartTime . plus Minutes ( 1 0 ) ĊĠĠĠ Ġval Ġnew StartTime Ġ= ĠLocalDateTime . now (). minus Minutes ( 5 ) ĊĠĠĠ Ġval Ġindex Status Ġ= ĠIndex Status ( currentIndex Ġ= ĠGREEN , ĠcurrentIndex State Ġ= ĠCOMP LETED , ĠcurrentIndex End Build Time Ġ= Ġold EndTime , ĠcurrentIndex Start Build Time Ġ= Ġold StartTime , Ġother Index State Ġ= ĠBUILD ING , Ġother Index Start Build Time Ġ= Ġnew StartTime , Ġother Index End Build Time Ġ= Ġnull ) ĊĊĠĠĠ Ġval Ġnew Status Ġ= Ġindex Status . to Switch Index () ĊĊĠĠĠ ĠassertThat ( new Status . currentIndex ). isEqualTo ( BLUE ) ĊĠĠĠ ĠassertThat ( new Status . currentIndex Start Build Time ). isEqualTo ( new StartTime ) ĊĠĠĠ ĠassertThat ( new Status . other Index ). isEqualTo ( GREEN ) ĊĠĠĠ ĠassertThat ( new Status . other Index End Build Time ). isEqualTo ( old EndTime ) ĊĠĠĠ ĠassertThat ( new Status . other Index Start Build Time ). isEqualTo ( old StartTime ) ĊĠĠĠ ĠassertThat ( new Status . other Index State ). isEqualTo ( COMPLETED ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` Will Ġfind Ġactive Ġindexes `() Ġ{ ĊĠĠĠ ĠassertThat ( Index Status ( currentIndex Ġ= ĠBL UE , ĠcurrentIndex State Ġ= ĠA BS ENT , Ġother Index State Ġ= ĠA BS ENT ). active Indexes ()). contains Exactly In Any Order () ĊĠĠĠ ĠassertThat ( Index Status ( currentIndex Ġ= ĠBL UE , ĠcurrentIndex State Ġ= ĠBUILD ING , Ġother Index State Ġ= ĠA BS ENT ). active Indexes ()). contains Exactly In Any Order ( BLUE ) ĊĠĠĠ ĠassertThat ( Index Status ( currentIndex Ġ= ĠBL UE , ĠcurrentIndex State Ġ= ĠCANCEL LED , Ġother Index State Ġ= ĠBUILD ING ). active Indexes ()). contains Exactly In Any Order ( GREEN ) ĊĠĠĠ ĠassertThat ( Index Status ( currentIndex Ġ= ĠBL UE , ĠcurrentIndex State Ġ= ĠCOMP LETED , Ġother Index State Ġ= ĠBUILD ING ). active Indexes ()). contains Exactly In Any Order ( BLUE , ĠGREEN ) ĊĠ Ġ} Ċ } Ċ