package Ġcom . example . spring boot helloworld Ċ Ċ import Ġorg . assertj . core . api . Assertions Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġorg . springframework . beans . factory . annotation . Autowired Ċ import Ġorg . springframework . boot . test . context . SpringBootTest Ċ import Ġorg . springframework . boot . test . web . client . Test Rest Template Ċ import Ġorg . springframework . boot . test . web . client . get For Entity Ċ import Ġorg . springframework . http . HttpStatus Ċ Ċ @ SpringBootTest Ċ class ĠSpring Boot HelloWorld Application Tests Ġ{ ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġcontext Load s () Ġ{ ĊĠĠĠ Ġ} Ċ Ċ } Ċ Ċ @ SpringBootTest ( web Environment Ġ= ĠSpring Boot Test . Web Environment . RANDOM _ PORT ) Ċ class ĠHello World Integration Tests (@ Autowired Ġval Ġrest Template : ĠTest Rest Template ) Ġ{ ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` G reeting Ġwith Ġsuccess `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġentity Ġ= Ġrest Template . get For Entity < String > ("/ hello - world / david ") ĊĊĠĠĠĠĠĠĠ ĠAssertions . assertThat ( entity . statusCode ). isEqualTo ( HttpStatus . OK ) ĊĠĠĠĠĠĠĠ ĠAssertions . assertThat ( entity . body ). isEqualTo (" Hello , Ġd avid ") ĊĠĠĠ Ġ} Ċ } Ċ