Test of the new version
For the new interface version, only the implementation had to be adjusted; the unit tests remain valid without changes.
Result
The repeated test ended successfully as expected: BUILD SUCCESS.
The additional Trace code 'after Rule' enables you to see the state of the model BEFORE and AFTER rule execution in the console output.
The console output of test run:
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running lfet.demo.InvoiceTotalTest
InvoiceTotal, 20260224.154217, 7, 1, InvoiceTotal_model(orderValue=10.00, orderDiscount=0.00, discountType=null, postage=5.72, totalPostage=0, totalDiscount=0, totalAmount=0)
InvoiceTotal_model(orderValue=10.00, orderDiscount=0.00, discountType=null, postage=5.72, totalPostage=5.72, totalDiscount=0, totalAmount=15.72)
InvoiceTotal, 20260224.154217, 7, 2, InvoiceTotal_model(orderValue=70.00, orderDiscount=30.00, discountType=%, postage=6.12, totalPostage=0, totalDiscount=0, totalAmount=0)
InvoiceTotal_model(orderValue=70.00, orderDiscount=30.00, discountType=%, postage=6.12, totalPostage=6.12, totalDiscount=21.00, totalAmount=55.12)
InvoiceTotal, 20260224.154217, 7, 3, InvoiceTotal_model(orderValue=50.00, orderDiscount=33.32, discountType=EUR, postage=6.12, totalPostage=0, totalDiscount=0, totalAmount=0)
InvoiceTotal_model(orderValue=50.00, orderDiscount=33.32, discountType=EUR, postage=6.12, totalPostage=6.12, totalDiscount=33.32, totalAmount=22.80)
InvoiceTotal, 20260224.154217, 7, 4, InvoiceTotal_model(orderValue=20.01, orderDiscount=20.01, discountType=EUR, postage=5.85, totalPostage=0, totalDiscount=0, totalAmount=0)
InvoiceTotal_model(orderValue=20.01, orderDiscount=20.01, discountType=EUR, postage=5.85, totalPostage=5.85, totalDiscount=0, totalAmount=25.86)
InvoiceTotal, 20260224.154217, 7, 5, InvoiceTotal_model(orderValue=50.00, orderDiscount=0.00, discountType=null, postage=3.11, totalPostage=0, totalDiscount=0, totalAmount=0)
InvoiceTotal_model(orderValue=50.00, orderDiscount=0.00, discountType=null, postage=3.11, totalPostage=3.11, totalDiscount=0, totalAmount=53.11)
InvoiceTotal, 20260224.154217, 7, 6, InvoiceTotal_model(orderValue=119.99, orderDiscount=60.00, discountType=EUR, postage=8.40, totalPostage=0, totalDiscount=0, totalAmount=0)
InvoiceTotal_model(orderValue=119.99, orderDiscount=60.00, discountType=EUR, postage=8.40, totalPostage=0, totalDiscount=60.00, totalAmount=59.99)
InvoiceTotal, 20260224.154217, 7, 7, InvoiceTotal_model(orderValue=90.00, orderDiscount=0.00, discountType=null, postage=9.66, totalPostage=0, totalDiscount=0, totalAmount=0)
InvoiceTotal_model(orderValue=90.00, orderDiscount=0.00, discountType=null, postage=9.66, totalPostage=0, totalDiscount=0, totalAmount=90.00)
[INFO]
[INFO] Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.354 s -- in lfet.demo.InvoiceTotalTest
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------