/* Ċ Ġ* ĠThis Ġis Ġfree Ġand Ġun enc umber ed Ġsoftware Ġreleased Ġinto Ġthe Ġpublic Ġdomain , Ġfollowing Ġ< https :// un license . org > Ċ Ġ*/ Ċ Ċ package Ġorg . u fo ss . kot ys a . spring . jdbc . m ariadb Ċ Ċ import Ġorg . assertj . core . api . Assertions . assertThat Ċ import Ġorg . junit . jupiter . api . Before All Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġorg . springframework . jdbc . core . Jdbc Operations Ċ import Ġorg . u fo ss . kot ys a . test .* Ċ import Ġorg . u fo ss . kot ys a . test . hooks . Test Containers Closeable Resource Ċ Ċ class ĠSpring Jdbc Select GroupBy M ariadb Test Ġ: ĠAbstract Spring Jdbc M ariadb Test < GroupBy Repository M ariadb Select >() Ġ{ ĊĊĠĠĠ Ġ@ Before All ĊĠĠĠ Ġfun Ġbefore All ( resource : ĠTest Containers Closeable Resource ) Ġ{ ĊĠĠĠĠĠĠĠ Ġcontext Ġ= Ġstart Context < GroupBy Repository M ariadb Select >( resource ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġval Ġrepository : ĠGroup By Repository M ariadb Select Ġby Ġlazy Ġ{ ĊĠĠĠĠĠĠĠ ĠgetContext Repository () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` Verify Ġselect Count Customer GroupBy Country Ġcounts Ġand Ġgroup `() Ġ{ ĊĠĠĠĠĠĠĠ ĠassertThat ( repository . select Count Customer GroupBy Country ()) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. has Size ( 2 ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. contains Exactly ( Pair ( 1 , Ġcustomer Fr ance . country ), ĠPair ( 2 , Ġcustomer USA 1 . country )) ĊĠĠĠ Ġ} Ċ } Ċ Ċ class ĠGroup By Repository M ariadb Select ( client : ĠJdbc Operations ) Ġ: ĠAbstract Customer Repository Spring Jdbc M ariadb ( client ) Ġ{ ĊĊĠĠĠ Ġfun Ġselect Count Customer GroupBy Country () Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ( sql Client Ġselect Count ĠM ARI AD B _ CUSTOMER . id Ġand ĠM ARI AD B _ CUSTOMER . country ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġfrom ĠM ARI AD B _ CUSTOMER ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġgroup By ĠM ARI AD B _ CUSTOMER . country ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ). fetch All () Ċ } Ċ