package Ġdev . d 1 s . ad vice . mapper . default Ċ Ċ import Ġdev . d 1 s . ad vice . entity . ErrorResponse Data Ċ import Ġdev . d 1 s . ad vice . mapper . default Impl . Constraint Violation Exception Mapper Ċ import Ġdev . d 1 s . te ab ag . testing . constant . VALID _ ST UB Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġorg . springframework . beans . factory . annotation . Autowired Ċ import Ġorg . springframework . boot . test . context . SpringBootTest Ċ import Ġorg . springframework . http . HttpStatus Ċ import Ġorg . springframework . test . context . Context Configuration Ċ import Ġstri kt . api . expect That Ċ import Ġstri kt . assertions . isEqualTo Ċ import Ġstri kt . assertions . isNull Ċ import Ġjavax . validation . Constraint Violation Exception Ċ Ċ @ SpringBootTest Ċ @ Context Configuration ( classes Ġ= Ġ[ Constraint Violation Exception Mapper :: class ]) Ċ internal Ġclass ĠConstraint Violation Exception Mapper Test Ġ{ ĊĊĠĠĠ Ġ@ Autowired ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġmapper : ĠConstraint Violation Exception Mapper ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` should Ġmap ĠConstraint Violation Exception Ġwith Ġvalid Ġresponse `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġconstraint Violation Exception Ġ= ĠConstraint Violation Exception ( VALID _ ST UB , Ġnull ) ĊĊĠĠĠĠĠĠĠ Ġexpect That ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġmapper . map ( constraint Violation Exception ) ĊĠĠĠĠĠĠĠ Ġ) Ġis EqualTo ĠError ResponseData ( HttpStatus . BAD _ REQUEST , ĠVALID _ ST UB ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` should Ġmap ĠRuntimeException Ġwith Ġnull `() Ġ{ ĊĠĠĠĠĠĠĠ Ġexpect That ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġmapper . map ( RuntimeException ()) ĊĠĠĠĠĠĠĠ Ġ). isNull () ĊĠĠĠ Ġ} Ċ }