package Ġcom . netflix . spin n aker . ke el . events Ċ Ċ import Ġcom . netflix . spin n aker . ke el . api . Environment Ċ import Ġcom . netflix . spin n aker . ke el . api . Notification Frequency Ċ import Ġcom . netflix . spin n aker . ke el . api . constraints . Constraint State Ċ import Ġcom . netflix . spin n aker . ke el . api . constraints . Constraint Status . OVERRIDE _ PASS Ċ import Ġcom . netflix . spin n aker . ke el . api . constraints . Default Constraint Attributes Ċ import Ġcom . netflix . spin n aker . ke el . api . plugins . Plugin Notification Config Ċ import Ġcom . netflix . spin n aker . ke el . api . plugins . Plugin Notifications Status Ċ import Ġcom . netflix . spin n aker . ke el . api . constraints . State ful Constraint Evaluator Ċ import Ġcom . netflix . spin n aker . ke el . api . constraints . Supported Constraint Type Ċ import Ġcom . netflix . spin n aker . ke el . api . events . Constraint StateChanged Ċ import Ġcom . netflix . spin n aker . ke el . constraints . State ful Constraint Evaluator Tests . Fixture . Fake Constraint Ċ import Ġcom . netflix . spin n aker . ke el . test . delivery Config Ċ import Ġdev . min ut est . junit . JUnit 5 Min ut ests Ċ import Ġdev . min ut est . root Context Ċ import Ġio . mock k . every Ċ import Ġio . mock k . just Ċ import Ġio . mock k . mock k Ċ import Ġio . mock k . runs Ċ import Ġio . mock k . verify Ċ import Ġorg . springframework . context . Application Event Publisher Ċ Ċ class ĠConstraint StateChanged Relay Tests Ġ: ĠJ Unit 5 Min ut ests Ġ{ ĊĠ Ġobject ĠFix ture Ġ{ ĊĠĠĠ Ġprivate Ġval Ġconstraint Ġ= ĠFake Constraint () ĊĊĠĠĠ Ġval Ġevent Ġ= ĠConstraint StateChanged ( ĊĠĠĠĠĠ Ġenvironment Ġ= ĠEnvironment ( ĊĠĠĠĠĠĠĠ Ġname Ġ= Ġ" test ", ĊĠĠĠĠĠĠĠ Ġconstraints Ġ= Ġset Of ( constraint ) ĊĠĠĠĠĠ Ġ), ĊĠĠĠĠĠ Ġconstraint Ġ= Ġconstraint , ĊĠĠĠĠĠ Ġprevious State Ġ= Ġnull , ĊĠĠĠĠĠ Ġcurrent State Ġ= ĠConstraint State ( ĊĠĠĠĠĠĠĠ Ġdelivery Config Name Ġ= Ġ" my config ", ĊĠĠĠĠĠĠĠ Ġenvironment Name Ġ= Ġ" test ", ĊĠĠĠĠĠĠĠ Ġartifact Reference Ġ= Ġ" wh atever ", ĊĠĠĠĠĠĠĠ Ġartifact Version Ġ= Ġ" wh atever ", ĊĠĠĠĠĠĠĠ Ġstatus Ġ= ĠOVER RIDE _ PASS , ĊĠĠĠĠĠĠĠ Ġtype Ġ= Ġconstraint . type ĊĠĠĠĠĠ Ġ), ĊĠĠĠĠĠ Ġdelivery Config Ġ= Ġdelivery Config () ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġval Ġplugin Notification Ġ= ĠPlugin Notification Config ( ĊĠĠĠĠĠ Ġtitle Ġ= Ġ" title ", ĊĠĠĠĠĠ Ġmessage Ġ= Ġ" message ", ĊĠĠĠĠĠ Ġstatus Ġ= ĠPlugin Notifications Status . FAILED , ĊĠĠĠĠĠ Ġbutton Text Ġ= Ġnull , ĊĠĠĠĠĠ Ġbutton Link Ġ= Ġnull , ĊĠĠĠĠĠ Ġnotification Level Ġ= ĠNotification Frequency . normal , ĊĠĠĠĠĠ Ġpro venance Ġ= Ġ" plugin ", ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġinternal Ġval Ġmatching Evaluator Ġ= Ġmock k < State ful Constraint Evaluator < Fake Constraint , ĠDefault Constraint Attributes >>() Ġ{ ĊĠĠĠĠĠ Ġevery Ġ{ Ġsupported Type Ġ} Ġreturns ĠSupported Constraint Type (" fake ", ĠFake Constraint :: class . java ) ĊĠĠĠĠĠ Ġevery Ġ{ Ġon Constraint StateChanged ( event ) Ġ} Ġjust Ġruns ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġinternal Ġval Ġnon Matching Evaluator Ġ= Ġmock k < State ful Constraint Evaluator < Fake Constraint , ĠDefault Constraint Attributes >>() Ġ{ ĊĠĠĠĠĠ Ġevery Ġ{ Ġsupported Type Ġ} Ġreturns ĠSupported Constraint Type (" the - wrong - fake ", ĠFake Constraint :: class . java ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġval Ġpublisher : ĠApplication Event Publisher Ġ= Ġmock k ( relax Unit Fun Ġ= Ġtrue ) ĊĊĠĠĠ Ġval Ġsubject Ġ= ĠConstraint StateChanged Relay ( listOf ( matching Evaluator , Ġnon Matching Evaluator ), Ġpublisher ) ĊĠ Ġ} ĊĊĠ Ġfun Ġtests () Ġ= Ġroot Context < Fixture > Ġ{ ĊĠĠĠ Ġcontext (" a Ġstate ful Ġconstraint Ġstate Ġchanged Ġevent Ġis Ġemitted ") Ġ{ ĊĠĠĠĠĠ Ġfixture Ġ{ ĠFix ture Ġ} ĊĊĠĠĠĠĠ Ġbefore Ġ{ ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġmatching Evaluator . on Constraint StateChanged With Notification ( event ) Ġ} Ġreturns Ġnull ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġnon Matching Evaluator . on Constraint StateChanged With Notification ( event ) Ġ} Ġreturns Ġnull ĊĠĠĠĠĠĠĠ Ġsubject . on Constraint StateChanged ( event ) ĊĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠ Ġtest (" the Ġevent Ġis Ġrelay ed Ġto Ġthe Ġcorrect Ġconstraint Ġevaluator ") Ġ{ ĊĠĠĠĠĠĠĠ Ġverify ( exact ly Ġ= Ġ 1 ) Ġ{ ĊĠĠĠĠĠĠĠĠĠ Ġmatching Evaluator . on Constraint StateChanged ( event ) ĊĠĠĠĠĠĠĠĠĠ Ġmatching Evaluator . on Constraint StateChanged With Notification ( event ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġverify ( exact ly Ġ= Ġ 0 ) Ġ{ ĊĠĠĠĠĠĠĠĠĠ Ġnon Matching Evaluator . on Constraint StateChanged ( event ) ĊĠĠĠĠĠĠĠĠĠ Ġnon Matching Evaluator . on Constraint StateChanged With Notification ( event ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġcontext (" the Ġevaluator Ġreturns Ġa Ġnotification ") Ġ{ ĊĠĠĠĠĠ Ġfixture Ġ{ ĠFix ture Ġ} ĊĊĠĠĠĠĠ Ġbefore Ġ{ ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġmatching Evaluator . on Constraint StateChanged With Notification ( event ) Ġ} Ġreturns Ġplugin Notification ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġnon Matching Evaluator . on Constraint StateChanged With Notification ( event ) Ġ} Ġreturns Ġnull ĊĠĠĠĠĠĠĠ Ġsubject . on Constraint StateChanged ( event ) ĊĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠ Ġtest (" the Ġnotification Ġis Ġpropag ated ") Ġ{ ĊĠĠĠĠĠĠĠ Ġverify ( exact ly Ġ= Ġ 1 ) Ġ{ ĊĠĠĠĠĠĠĠĠĠ Ġpublisher . publish Event ( Plugin Notification ( plugin Notification , Ġevent )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĠ Ġ} Ċ } Ċ