@Test
  public void addsItemToCartAndRedirectsToCartPage() throws Exception {
    request.addParameter("item-number", itemNumber);

    context.checking(
        new Expectations() {
          {
            oneOf(salesAssistant).addToCart(with(equal(new ItemNumber(itemNumber))));
          }
        });

    createCartItem.handle(request, response);

    response.assertRedirectedTo("/cart");
  }
 @Test
 public void setsResponseContentTypeToHtml() {
   response.assertHeader("Content-Type", equalTo("text/html; charset=utf-8"));
 }
 @Test
 public void rendersErrorTemplate() {
   response.assertBody(containsString(errorMessage));
   response.assertBody(containsString("stack.trace(line:1)"));
   response.assertBody(containsString("stack.trace(line:2)"));
 }
 @Test
 public void setStatusToInternalServerError() {
   response.assertStatus(HttpStatus.INTERNAL_SERVER_ERROR);
 }