}
@Test
public void testCreate() {
orderService.create(orderTO);
final Order o = order;
verify(dao).create(argThat(new BaseMatcher<Order>() {
@Override
public boolean matches(Object item) {
if (!(item instanceof Order)) {
return false;
}
Order no = (Order) item;
if (!Objects.equals(no.getCarType(), o.getCarType())) {
return false;
}
if (!Objects.equals(no.getCustomer(), o.getCustomer())) {
return false;
}
if (!Objects.equals(no.getOrderNewDate(), o.getOrderNewDate())) {
return false;
}
if (!Objects.equals(no.getOrderPaidDate(), o.getOrderPaidDate())) {
return false;
}
if (!Objects.equals(no.getOrderServicedDate(), o.getOrderServicedDate())) {
return false;
}
if (!Objects.equals(no.getTotalPrice(), o.getTotalPrice())) {
return false;
}
if (!(no.getExtraServices().containsAll(o.getExtraServices()) && o.getExtraServices().containsAll(no.getExtraServices()))) {
return false;
}
if (no.getTyres() == null || o.getTyres() == null) {
if (no.getTyres() != null || o.getTyres() != null) {
return false;
}
}
if (no.getTyres().size() != o.getTyres().size()) {
return false;
}
for (Map.Entry<TyrePosition, Tyre> me : no.getTyres().entrySet()) {
Tyre t = o.getTyres().get(me.getKey());
if (!Objects.equals(t, me.getValue())) {
return false;
}
}