package Ġorg . ge ep aw h ill . rules Ċ Ċ import Ġorg . assertj . core . api . Assertions . assertThat Ċ import Ġorg . ge ep aw h ill . rules . domain . Rule Ċ import Ġorg . ge ep aw h ill . rules . ui . Rule book Model Ċ import Ġorg . junit . jupiter . api . Test ĊĊ Ċ class ĠRule book Model Test Ġ{ ĊĠĠĠ Ġval Ġmodel Ġ= ĠRule book Model () ĊĠĠĠ Ġval Ġfirst Rule Ġ= ĠRule (" 1 ", Ġ" 1 ") ĊĠĠĠ Ġval Ġsecond Rule Ġ= ĠRule (" 2 ", Ġ" 2 ") ĊĠĠĠ Ġval Ġthird Rule Ġ= ĠRule (" 3 ", Ġ" 3 ") ĊĠĠĠ Ġval Ġfourth Rule Ġ= ĠRule (" 4 ", Ġ" 4 ") ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` low ers Ġone Ġrules Ġpriority `() Ġ{ ĊĠĠĠĠĠĠĠ Ġmodel . included . add ( first Rule ) ĊĠĠĠĠĠĠĠ Ġmodel . included . add ( second Rule ) ĊĊĠĠĠĠĠĠĠ Ġmodel . lower ( listOf ( first Rule )) ĊĠĠĠĠĠĠĠ ĠassertThat ( model . included ). contains Exactly ( second Rule , Ġfirst Rule ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` lower ing Ġis Ġnoop Ġif Ġsingle Ġrule Ġis Ġlast `() Ġ{ ĊĠĠĠĠĠĠĠ Ġmodel . included . add ( first Rule ) ĊĠĠĠĠĠĠĠ Ġmodel . included . add ( second Rule ) ĊĊĠĠĠĠĠĠĠ Ġmodel . lower ( listOf ( second Rule )) ĊĠĠĠĠĠĠĠ ĠassertThat ( model . included ). contains Exactly ( first Rule , Ġsecond Rule ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` lower Ġis Ġnoop Ġif Ġmultiple Ġrule Ġincludes Ġlast `() Ġ{ ĊĠĠĠĠĠĠĠ Ġmodel . included . add ( first Rule ) ĊĠĠĠĠĠĠĠ Ġmodel . included . add ( second Rule ) ĊĠĠĠĠĠĠĠ Ġmodel . included . add ( third Rule ) ĊĊĠĠĠĠĠĠĠ Ġmodel . lower ( listOf ( first Rule , Ġthird Rule )) ĊĠĠĠĠĠĠĠ ĠassertThat ( model . included ). contains Exactly ( first Rule , Ġsecond Rule , Ġthird Rule ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` lower Ġis Ġnoop Ġif Ġmultiple Ġrule Ġincludes Ġlast , Ġinput Ġorder Ġin sign ificant `() Ġ{ ĊĠĠĠĠĠĠĠ Ġmodel . included . add ( first Rule ) ĊĠĠĠĠĠĠĠ Ġmodel . included . add ( second Rule ) ĊĠĠĠĠĠĠĠ Ġmodel . included . add ( third Rule ) ĊĊĠĠĠĠĠĠĠ Ġmodel . lower ( listOf ( third Rule , Ġfirst Rule )) ĊĠĠĠĠĠĠĠ ĠassertThat ( model . included ). contains Exactly ( first Rule , Ġsecond Rule , Ġthird Rule ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` valid Ġstraight Ġsequence Ġlow ers Ġpriority Ġfor Ġall `() Ġ{ ĊĠĠĠĠĠĠĠ Ġmodel . included . add ( first Rule ) ĊĠĠĠĠĠĠĠ Ġmodel . included . add ( second Rule ) ĊĠĠĠĠĠĠĠ Ġmodel . included . add ( third Rule ) ĊĊĠĠĠĠĠĠĠ Ġmodel . lower ( listOf ( first Rule , Ġsecond Rule )) ĊĠĠĠĠĠĠĠ ĠassertThat ( model . included ). contains Exactly ( third Rule , Ġfirst Rule , Ġsecond Rule ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` valid Ġnon - stra ight Ġsequence Ġlow ers Ġpriority Ġfor Ġall `() Ġ{ ĊĠĠĠĠĠĠĠ Ġmodel . included . add ( first Rule ) ĊĠĠĠĠĠĠĠ Ġmodel . included . add ( second Rule ) ĊĠĠĠĠĠĠĠ Ġmodel . included . add ( third Rule ) ĊĠĠĠĠĠĠĠ Ġmodel . included . add ( four th Rule ) ĊĊĠĠĠĠĠĠĠ Ġmodel . lower ( listOf ( first Rule , Ġthird Rule )) ĊĠĠĠĠĠĠĠ ĠassertThat ( model . included ). contains Exactly ( second Rule , Ġfirst Rule , Ġfourth Rule , Ġthird Rule ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` raises Ġone Ġrules Ġpriority `() Ġ{ ĊĠĠĠĠĠĠĠ Ġmodel . included . add ( first Rule ) ĊĠĠĠĠĠĠĠ Ġmodel . included . add ( second Rule ) ĊĊĠĠĠĠĠĠĠ Ġmodel . raise ( listOf ( second Rule )) ĊĠĠĠĠĠĠĠ ĠassertThat ( model . included ). contains Exactly ( second Rule , Ġfirst Rule ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` ra ising Ġis Ġnoop Ġif Ġsingle Ġrule Ġis Ġfirst `() Ġ{ ĊĠĠĠĠĠĠĠ Ġmodel . included . add ( first Rule ) ĊĠĠĠĠĠĠĠ Ġmodel . included . add ( second Rule ) ĊĊĠĠĠĠĠĠĠ Ġmodel . raise ( listOf ( first Rule )) ĊĠĠĠĠĠĠĠ ĠassertThat ( model . included ). contains Exactly ( first Rule , Ġsecond Rule ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` raise Ġis Ġnoop Ġif Ġmultiple Ġrule Ġincludes Ġfirst `() Ġ{ ĊĠĠĠĠĠĠĠ Ġmodel . included . add ( first Rule ) ĊĠĠĠĠĠĠĠ Ġmodel . included . add ( second Rule ) ĊĠĠĠĠĠĠĠ Ġmodel . included . add ( third Rule ) ĊĊĠĠĠĠĠĠĠ Ġmodel . raise ( listOf ( first Rule , Ġthird Rule )) ĊĠĠĠĠĠĠĠ ĠassertThat ( model . included ). contains Exactly ( first Rule , Ġsecond Rule , Ġthird Rule ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` raise Ġis Ġnoop Ġif Ġmultiple Ġrule Ġincludes Ġfirst , Ġinput Ġorder Ġdoes Ġnot Ġmatter `() Ġ{ ĊĠĠĠĠĠĠĠ Ġmodel . included . add ( first Rule ) ĊĠĠĠĠĠĠĠ Ġmodel . included . add ( second Rule ) ĊĠĠĠĠĠĠĠ Ġmodel . included . add ( third Rule ) ĊĊĠĠĠĠĠĠĠ Ġmodel . raise ( listOf ( third Rule , Ġfirst Rule )) ĊĠĠĠĠĠĠĠ ĠassertThat ( model . included ). contains Exactly ( first Rule , Ġsecond Rule , Ġthird Rule ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` valid Ġstraight Ġsequence Ġraises Ġpriority Ġfor Ġall `() Ġ{ ĊĠĠĠĠĠĠĠ Ġmodel . included . add ( first Rule ) ĊĠĠĠĠĠĠĠ Ġmodel . included . add ( second Rule ) ĊĠĠĠĠĠĠĠ Ġmodel . included . add ( third Rule ) ĊĊĠĠĠĠĠĠĠ Ġmodel . raise ( listOf ( second Rule , Ġthird Rule )) ĊĠĠĠĠĠĠĠ ĠassertThat ( model . included ). contains Exactly ( second Rule , Ġthird Rule , Ġfirst Rule ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` valid Ġnon - stra ight Ġsequence Ġraises Ġpriority Ġfor Ġall `() Ġ{ ĊĠĠĠĠĠĠĠ Ġmodel . included . add ( first Rule ) ĊĠĠĠĠĠĠĠ Ġmodel . included . add ( second Rule ) ĊĠĠĠĠĠĠĠ Ġmodel . included . add ( third Rule ) ĊĠĠĠĠĠĠĠ Ġmodel . included . add ( four th Rule ) ĊĊĠĠĠĠĠĠĠ Ġmodel . raise ( listOf ( second Rule , Ġfourth Rule )) ĊĠĠĠĠĠĠĠ ĠassertThat ( model . included ). contains Exactly ( second Rule , Ġfirst Rule , Ġfourth Rule , Ġthird Rule ) ĊĠĠĠ Ġ} Ċ Ċ }