package Ġcom . github . ch ristop h pick l . k pot p our ri . http 4 k . internal Ċ Ċ import Ġcom . github . ch ristop h pick l . k pot p our ri . http 4 k . Http 4 k StatusCode Exception Ċ import Ġcom . github . ch ristop h pick l . k pot p our ri . http 4 k . Request 4 k Ċ import Ġcom . github . ch ristop h pick l . k pot p our ri . http 4 k . Response 4 k Ċ import Ġcom . github . ch ristop h pick l . k pot p our ri . http 4 k . SC _ 2 0 0 _ Ok Ċ import Ġcom . github . ch ristop h pick l . k pot p our ri . http 4 k . SC _ 4 0 4 _ NotFound Ċ import Ġcom . github . ch ristop h pick l . k pot p our ri . http 4 k . Status Check Mode Ċ import Ġcom . github . ch ristop h pick l . k pot p our ri . http 4 k . Status Check Result Ċ import Ġcom . github . ch ristop h pick l . k pot p our ri . http 4 k . Status Family Ċ import Ġcom . github . ch ristop h pick l . k pot p our ri . http 4 k . non _ test . test Dummy Ċ import Ġcom . github . ch ristop h pick l . k pot p our ri . test 4 k . assert Thrown Ċ import Ġcom . github . ch ristop h pick l . k pot p our ri . test 4 k . message Contains Ċ import Ġcom . nat pr y ce . ham k rest . assertion . assertThat Ċ import Ġcom . nat pr y ce . ham k rest . equalTo Ċ import Ġorg . testng . annotations . DataProvider Ċ import Ġorg . testng . annotations . Test Ċ Ċ @ Test Ċ class Ġstatus _ code _ check Kt Test Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġnot Set At All Ġ= ĠStatus Check Mode . Not Set At All ĊĠĠĠ Ġprivate Ġval Ġdisabled Ġ= ĠStatus Check Mode . Anything ĊĠĠĠ Ġprivate Ġval Ġen forced 1 Ġ= ĠStatus Check Mode . En fore ( 1 ) ĊĠĠĠ Ġprivate Ġval Ġen forced 2 Ġ= ĠStatus Check Mode . En fore ( 2 ) ĊĠĠĠ Ġprivate Ġval Ġen forced Ġ= Ġen forced 1 ĊĠĠĠ Ġprivate Ġval Ġcustom Ġ= ĠStatus Check Mode . Custom ({ Ġ_, Ġ_ Ġ-> ĠStatus Check Result . Ok Ġ}) ĊĊĠĠĠ Ġ@ DataProvider ĊĠĠĠ Ġfun Ġnull If Empty Provider (): ĠArray < Array < out ĠAny ? >> Ġ= ĠarrayOf ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠarrayOf ( not Set At All , Ġnot Set At All , Ġnot Set At All ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠarrayOf ( not Set At All , Ġen forced , Ġen forced ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠarrayOf ( en forced , Ġdisabled , Ġdisabled ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠarrayOf ( en forced , Ġnot Set At All , Ġen forced ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠarrayOf ( en forced 1 , Ġen forced 2 , Ġen forced 2 ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠarrayOf ( en forced , Ġcustom , Ġcustom ) ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġ@ Test ( dataProvider Ġ= Ġ" null If Empty Provider ") ĊĠĠĠ Ġfun Ġ` proper Checker `( global : ĠStatus Check Mode , Ġrequest : ĠStatus Check Mode , Ġexpected : ĠStatus Check Mode ) Ġ{ ĊĠĠĠĠĠĠĠ ĠassertThat ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġrequest Scope Go es Before Global Scope ( global , Ġrequest ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠequalTo ( expected Ġas ĠAny )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġ` check StatusCode Ġ- Ġglobal Ġnot Ġset , Ġrequest Ġenforce Ġfamily Ġ 4 , Ġwhen Ġ 2 0 0 , ĠThen Ġthrow Ġexception Ġwith Ġproper Ġmessage `() Ġ{ ĊĠĠĠĠĠĠĠ Ġassert Thrown < Http 4 k StatusCode Exception >({ Ġe Ġ-> Ġe . message Contains (" 2 0 0 ", Ġ" 4 xx ") Ġ}) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcheck StatusCode ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġglobal Ġ= ĠStatus Check Mode . Not Set At All , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġrequest Ġ= ĠStatus Check Mode . En force Family ( Status Family . Client Error _ 4 ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġrequest 4 k Ġ= ĠRequest 4 k . test Dummy , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġresponse 4 k Ġ= ĠResponse 4 k . test Dummy . copy ( statusCode Ġ= ĠSC _ 2 0 0 _ Ok )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġ` check StatusCode Ġ- Ġglobal Ġnot Ġset , Ġrequest Ġenforce Ġfamily Ġ 4 , Ġwhen Ġ 4 0 4 , ĠThen ĠOk `() Ġ{ ĊĠĠĠĠĠĠĠ Ġcheck StatusCode ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġglobal Ġ= ĠStatus Check Mode . Not Set At All , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġrequest Ġ= ĠStatus Check Mode . En force Family ( Status Family . Client Error _ 4 ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġrequest 4 k Ġ= ĠRequest 4 k . test Dummy , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġresponse 4 k Ġ= ĠResponse 4 k . test Dummy . copy ( statusCode Ġ= ĠSC _ 4 0 4 _ NotFound )) ĊĠĠĠ Ġ} Ċ } Ċ