@Test public void testUpdateAddressesToOrderUpdateAction() { withFilledCartAndMultipleAddresses(client(), cart -> { withCustomer(client(),customer -> { withOrder(client(),customer,cart,order -> { final List<Address> addresses = order.getItemShippingAddresses(); final Address firstAddress = addresses.get(0); assertThat(firstAddress.getCountry()).isNotEqualByComparingTo(CountryCode.CA); final String firstAddressKey = firstAddress.getKey(); final Address updatedAddress = Address.of(CountryCode.CA).withKey(firstAddressKey); final Order updatedOrder= client().executeBlocking(OrderUpdateCommand.of(order, UpdateItemShippingAddress.of(updatedAddress))); List<Address> newAddresses = updatedOrder.getItemShippingAddresses().stream().filter(address -> address.getKey().equals(firstAddressKey)).collect(Collectors.toList()); assertThat(newAddresses).hasSize(1); assertThat(newAddresses.get(0).getCountry()).isEqualByComparingTo(CountryCode.CA); return updatedOrder; }); }); }); }