package Ġcom . d restaurant . customer . domain Ċ Ċ import Ġcom . d restaurant . common . domain . api . model . Audit Entry Ċ import Ġcom . d restaurant . common . domain . api . model . Money Ċ import Ġcom . d restaurant . common . domain . api . model . Person Name Ċ import Ġcom . d restaurant . customer . domain . api . Create Customer Command Ċ import Ġcom . d restaurant . customer . domain . api . Customer Created Event Ċ 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 . math . BigDecimal Ċ import Ġjava . util .* Ċ Ċ class ĠCustomer Aggregate Test Ġ{ ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġfixture : ĠFix ture Configuration < Customer > ĊĠĠĠ Ġprivate Ġval Ġwho Ġ= Ġ" john doe " ĊĠĠĠ Ġprivate Ġval Ġaudit Entry : ĠAudit Entry Ġ= ĠAudit Entry ( who , ĠCalendar . getInstance (). time ) ĊĠĠĠ Ġprivate Ġval Ġaudit Entry 2 : ĠAudit Entry Ġ= ĠAudit Entry ( who Ġ+ Ġ" 2 ", ĠCalendar . getInstance (). time ) ĊĠĠĠ Ġprivate Ġval Ġorder Limit Ġ= ĠMoney ( BigDecimal . valueOf ( 1 0 0 0 0 0 0 )) ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun ĠsetUp () Ġ{ ĊĠĠĠĠĠĠĠ Ġfixture Ġ= ĠAggregate TestFixture ( Customer :: class . java ) ĊĠĠĠĠĠĠĠ Ġfixture . register Command Dispatch Interceptor ( Bean Validation Interceptor ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġcreate Customer Test () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġname Ġ= ĠPerson Name (" I van ", Ġ" D ug alic ") ĊĠĠĠĠĠĠĠ Ġval Ġcreate Customer Command Ġ= ĠCreate Customer Command ( name , Ġorder Limit , Ġaudit Entry ) ĊĠĠĠĠĠĠĠ Ġval Ġcustomer Created Event Ġ= ĠCustomer Created Event ( name , Ġorder Limit , Ġcreate Customer Command . target Aggregate Identifier , Ġaudit Entry ) ĊĊĠĠĠĠĠĠĠ Ġfixture ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. given () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. ` when `( create Customer Command ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. expect Events ( customer Created Event ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ( expected Ġ= ĠAx on AssertionError :: class ) ĊĠĠĠ Ġfun Ġcreate Customer Ax on AssertionError Test () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġname Ġ= ĠPerson Name (" I van ", Ġ" D ug alic ") ĊĠĠĠĠĠĠĠ Ġval Ġcreate Customer Command Ġ= ĠCreate Customer Command ( name , Ġorder Limit , Ġaudit Entry ) ĊĠĠĠĠĠĠĠ Ġ// ĠSetting Ġthe ĠWR ONG Ġaudit Entry ĊĠĠĠĠĠĠĠ Ġval Ġcustomer Created Event Ġ= ĠCustomer Created Event ( name , Ġorder Limit , Ġcreate Customer Command . target Aggregate Identifier , Ġaudit Entry 2 ) ĊĊĠĠĠĠĠĠĠ Ġfixture ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. given () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. ` when `( create Customer Command ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. expect Exception ( Ax on AssertionError :: class . java ) ĊĊĠĠĠ Ġ} Ċ Ċ } Ċ