package Ġcom . bench profile . api . hardware . concept 1 Ċ Ċ import Ġorg . assertj . core . api . Assertions . assertThat Ċ 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 . boot . test . autoconfigure . orm . jpa . Test EntityManager Ċ import Ġorg . springframework . data . repository . findById OrNull Ċ Ċ @ Data Jpa Test Ċ class ĠHardware Repository Test Ġ@ Autowired Ġconstructor ( ĊĠĠĠĠĠĠĠ Ġval Ġentity Manager : ĠTest EntityManager , ĊĠĠĠĠĠĠĠ Ġval Ġhardware Repository : ĠHardware Repository Ċ ) Ġ{ ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` When Ġfind ById OrNull Ġthen Ġreturn ĠHardware `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġhardware Ġ= ĠHardware (" Test ") ĊĠĠĠĠĠĠĠ Ġentity Manager . persist ( hardware ) ĊĠĠĠĠĠĠĠ Ġentity Manager . flush () ĊĠĠĠĠĠĠĠ Ġval Ġfound Ġ= Ġhardware Repository . findById OrNull ( hardware . id !! ) ĊĠĠĠĠĠĠĠ ĠassertThat ( found ). isEqualTo ( hardware ) ĊĠĠĠ Ġ} Ċ } Ċ