package Ġio . github . gab riel sh an ahan . g azer . data . integration Ċ Ċ import Ġio . github . gab riel sh an ahan . g azer . data . Data Samples Ċ import Ġio . github . gab riel sh an ahan . g azer . data . repository . Mon itored Endpoint Repository Ċ import Ġio . github . gab riel sh an ahan . g azer . data . repository . Monitoring Result Repository Ċ import Ġio . github . gab riel sh an ahan . g azer . data . repository . UserRepository Ċ import Ġorg . junit . jupiter . api . Assertions Ċ import Ġorg . junit . jupiter . api . BeforeEach Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġorg . springframework . beans . factory . annotation . Autowired Ċ import Ġorg . springframework . boot . test . autoconfigure . orm . jpa . Data Jpa Test Ċ import Ġorg . springframework . data . domain . Page Request Ċ import Ġorg . springframework . data . domain . Sort Ċ Ċ @ Data Jpa Test Ċ final Ġclass ĠMonitoring Result Repository Test ( ĊĠĠĠ Ġ@ Autowired Ġvar Ġendpoint Repo : ĠMon itored Endpoint Repository , ĊĠĠĠ Ġ@ Autowired Ġvar Ġresult Repo : ĠMonitoring Result Repository , ĊĠĠĠ Ġ@ Autowired Ġvar Ġuser Repo : ĠUser Repository Ċ ) Ġ{ ĊĠĠĠ Ġprivate Ġval Ġshared Data Ġ= ĠData Samples ( user Repo ) ĊĊĠĠĠ Ġ@ BeforeEach ĊĠĠĠ Ġfun Ġsetup () Ġ{ ĊĠĠĠĠĠĠĠ Ġendpoint Repo . save All ( listOf ( shared Data . google Endpoint , Ġshared Data . yahoo Endpoint )) ĊĠĠĠĠĠĠĠ Ġresult Repo . save All ( shared Data . google Results ) ĊĠĠĠĠĠĠĠ Ġresult Repo . save All ( shared Data . yahoo Results ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` Filtering Ġby Ġuser Ġworks Ġas Ġexpected `() Ġ{ ĊĊĠĠĠĠĠĠĠ Ġval Ġap pl ifting Results Ġ= Ġresult Repo . getAll By Mon itored Endpoint User OrderBy Checked Desc ( shared Data . appl ifting User ) ĊĠĠĠĠĠĠĠ Ġval Ġbat man Results Ġ= Ġresult Repo . getAll By Mon itored Endpoint User OrderBy Checked Desc ( shared Data . bat man User ) ĊĊĠĠĠĠĠĠĠ ĠAssertions . assertEquals ( 3 , Ġap pl ifting Results . size ) ĊĠĠĠĠĠĠĠ ĠAssertions . assertEquals ( 2 , Ġbat man Results . size ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` Ordering Ġworks Ġas Ġexpected `() Ġ{ ĊĊĠĠĠĠĠĠĠ Ġval Ġap pl ifting Results Ġ= Ġresult Repo . getAll By Mon itored Endpoint User OrderBy Checked Desc ( shared Data . appl ifting User ) ĊĊĠĠĠĠĠĠĠ ĠAssertions . assertTrue ( appl ifting Results [ 0 ]. checked Ġ> Ġap pl ifting Results [ 1 ]. checked ) ĊĠĠĠĠĠĠĠ ĠAssertions . assertTrue ( appl ifting Results [ 1 ]. checked Ġ> Ġap pl ifting Results [ 2 ]. checked ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` Pagination Ġworks Ġas Ġexpected `() Ġ{ ĊĊĠĠĠĠĠĠĠ Ġval Ġap pl ifting Results Ġ= Ġresult Repo . getAll By Mon itored Endpoint ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġshared Data . appl ifting . endpoints [ 0 ], ĊĠĠĠĠĠĠĠĠĠĠĠ ĠPage Request . of ( 0 , Ġ 2 , ĠSort . by (" checked "). desc ending ()) ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ ĠAssertions . assertEquals ( 2 , Ġap pl ifting Results . size ) ĊĠĠĠĠĠĠĠ ĠAssertions . assertTrue ( appl ifting Results [ 0 ]. checked Ġ> Ġap pl ifting Results [ 1 ]. checked ) ĊĠĠĠ Ġ} Ċ } Ċ