@Test
public void updateCartItems() throws Exception {
// Arrange
final CartDto expectedCart = new CartDto();
expectedCart.setItemTotal("2");
final UserDto clientUser = new UserDto();
clientUser.setApiKey("apiKey");
clientUser.setSecretKey("secretKey");
URI expectedUri = URI.create("http://localhost:8080/mbm/cart");
// Test-specific JerseyClient behaviour
when(client.resource(expectedUri))
.thenReturn(webResource);
// Use builder since it is a PUT
when(builder.put(String.class))
.thenReturn(FixtureAsserts.jsonFixture("/fixtures/hal/cart/expected-public-update-cart.json"));
// Act
List<PublicCartItemDto> cartItems = Lists.newArrayList();
CartDto actualCart = PublicMerchantClient
.newInstance(locale)
.cart()
.updateCartItems(clientUser, cartItems);
// Assert
assertEquals("Unexpected item count", "2", actualCart.getItemTotal());
}