package Ġuk . gov . just ice . digital . h mp ps . oauth 2 server . auth . repository Ċ Ċ import Ġorg . assertj . core . api . Assertions Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġorg . springframework . beans . factory . annotation . Autowired Ċ import Ġorg . springframework . boot . test . autoconfigure . jdbc . Auto Configure Test Database Ċ import Ġorg . springframework . boot . test . autoconfigure . orm . jpa . Data Jpa Test Ċ import Ġorg . springframework . context . annotation . Import Ċ import Ġorg . springframework . data . repository . findById OrNull Ċ import Ġorg . springframework . test . context . Active Profiles Ċ import Ġorg . springframework . test . context . transaction . Test Transaction Ċ import Ġorg . springframework . transaction . annotation . Transactional Ċ import Ġuk . gov . just ice . digital . h mp ps . oauth 2 server . auth . model . Client Allowed Ips Ċ import Ġuk . gov . just ice . digital . h mp ps . oauth 2 server . config . Auth Db Config Ċ Ċ @ Data Jpa Test Ċ @ Active Profiles (" test ") Ċ @ Import ( Auth Db Config :: class ) Ċ @ Auto Configure Test Database ( replace Ġ= ĠAuto Configure Test Database . Replace . NONE ) Ċ @ Transactional Ċ class ĠClient Allowed Ips Repository Test Ġ{ ĊĊĠ Ġ@ Autowired ĊĠ Ġprivate Ġlateinit Ġvar Ġrepository : ĠClient Allowed Ips Repository ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġgiven AT rans ient Entity It Can Be Pers isted () Ġ{ ĊĠĠĠ Ġval Ġtransient Entity Ġ= Ġtransient Entity () ĊĠĠĠ Ġval Ġentity Ġ= ĠClient Allowed Ips ( transient Entity . base ClientId , Ġtransient Entity . ips ) ĊĠĠĠ Ġval Ġpersisted Entity Ġ= Ġrepository . save ( entity ) ĊĠĠĠ ĠTest Transaction . flag For Commit () ĊĠĠĠ ĠTest Transaction . end () ĊĠĠĠ ĠAssertions . assertThat ( pers isted Entity . base ClientId ). isNotNull () ĊĠĠĠ ĠTest Transaction . start () ĊĠĠĠ Ġval Ġretrieved Entity Ġ= Ġrepository . findById OrNull ( entity . base ClientId ) ĊĊĠĠĠ Ġ// Ġequals Ġonly Ġcomp ares Ġthe Ġbusiness Ġkey Ġcolumns ĊĠĠĠ ĠAssertions . assertThat ( retrie ved Entity ). isEqualTo ( transient Entity ) ĊĠĠĠ ĠAssertions . assertThat ( retrie ved Entity ?. ips ). isEqualTo ( transient Entity . ips ) ĊĠĠĠ ĠAssertions . assertThat ( retrie ved Entity ?. base ClientId ). isEqualTo ( transient Entity . base ClientId ) ĊĠĠĠ ĠAssertions . assertThat ( retrie ved Entity ?. allowed Ips With New lines ). isEqualTo ( ĊĠĠĠĠĠ Ġtransient Entity . allowed Ips With New lines ĊĠĠĠ Ġ) ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġtransient Entity (): ĠClient Allowed Ips Ġ= ĠClient Allowed Ips (" hdc ", ĠlistOf (" 1 2 7 . 0 . 0 . 1 ")) Ċ } Ċ