package Ġcom . d restaurant . cour ier . domain Ċ Ċ import Ġcom . d restaurant . common . domain . model . Audit Entry Ċ import Ġcom . d restaurant . common . domain . model . Person Name Ċ import Ġcom . d restaurant . cour ier . domain . api . Courier Created Event Ċ import Ġcom . d restaurant . cour ier . domain . api . Create Courier Command Ċ import Ġorg . ax on framework . messaging . intercept ors . Bean Validation Interceptor Ċ import Ġorg . ax on framework . test . Ax on AssertionError Ċ import Ġorg . ax on framework . test . aggregate . Aggregate TestFixture Ċ import Ġorg . ax on framework . test . aggregate . Fixture Configuration Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ import Ġjava . util .* Ċ Ċ class ĠCour ier Aggregate Test Ġ{ ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġfixture : ĠFix ture Configuration < Courier > ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġaudit Entry : ĠAudit Entry ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġaudit Entry 2 : ĠAudit Entry ĊĠĠĠ Ġprivate Ġvar Ġmax NumberOf Active Orders : ĠInt Ġ= Ġ 5 ĊĠĠĠ Ġprivate Ġval ĠW HO Ġ= Ġ" john doe " ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun ĠsetUp () Ġ{ ĊĠĠĠĠĠĠĠ Ġfixture Ġ= ĠAggregate TestFixture ( Courier :: class . java ) ĊĠĠĠĠĠĠĠ Ġfixture . register Command Dispatch Interceptor ( Bean Validation Interceptor ()) ĊĠĠĠĠĠĠĠ Ġaudit Entry Ġ= ĠAudit Entry ( W HO , ĠCalendar . getInstance (). time ) ĊĠĠĠĠĠĠĠ Ġaudit Entry 2 Ġ= ĠAudit Entry ( W HO Ġ+ Ġ" 2 ", ĠCalendar . getInstance (). time ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġcreate Courier Test () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġname Ġ= ĠPerson Name (" I van ", Ġ" D ug alic ") ĊĠĠĠĠĠĠĠ Ġval Ġcreate Courier Command Ġ= ĠCreate Courier Command ( name , Ġmax NumberOf Active Orders , Ġaudit Entry ) ĊĠĠĠĠĠĠĠ Ġval Ġcour ier Created Event Ġ= ĠCour ier Created Event ( name , Ġmax NumberOf Active Orders , Ġcreate Courier Command . target Aggregate Identifier , Ġaudit Entry ) ĊĊĠĠĠĠĠĠĠ Ġfixture ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. given () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. ` when `( create Courier Command ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. expect Events ( cour ier Created Event ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ( expected Ġ= ĠAx on AssertionError :: class ) ĊĠĠĠ Ġfun Ġcreate Courier Ax on AssertionError Test () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġname Ġ= ĠPerson Name (" I van ", Ġ" D ug alic ") ĊĠĠĠĠĠĠĠ Ġval Ġcreate Courier Command Ġ= ĠCreate Courier Command ( name , Ġmax NumberOf Active Orders , Ġaudit Entry ) ĊĊĠĠĠĠĠĠĠ Ġfixture ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. given () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. ` when `( create Courier Command ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. expect Exception ( Ax on AssertionError :: class . java ) ĊĊĠĠĠ Ġ} Ċ Ċ } Ċ