/**
   * Test if the model contains a <code>null</code> {@link Client} by passing an invalid ID
   * argument. The following conditions are checked :<br>
   *
   * <ul>
   *   <li>The model contains an attribute called "client"
   *   <li>This attribute has a <code>null</code> value
   * </ul>
   */
  @Test
  public void testEditWithInvalidId() {
    controller.edit(m, Long.MAX_VALUE);
    Map<String, Object> map = m.asMap();

    assertTrue(m.containsAttribute("client"));
    assertNull(map.get("client"));
  }
  /** Test if the updating throw a {@link NullPointerException} by passing an invalid ID argument */
  @Test(expected = NullPointerException.class)
  public void testUpdateWithInvalidId() {
    controller.edit(m, Long.MAX_VALUE);
    Map<String, Object> map = m.asMap();
    Client c = (Client) map.get("client");

    c.setName("Sun");
    controller.update(c, new MapBindingResult(Collections.emptyMap(), ""));
  }
  /**
   * Test if the model contains a {@link Client} object. The following conditions are checked :<br>
   *
   * <ul>
   *   <li>The model contains an attribute called "client"
   *   <li>This attribute is equal to the {@link Client} created before in setUp() method
   * </ul>
   */
  @Test
  public void testEdit() {
    controller.edit(m, clientId);
    Map<String, Object> map = m.asMap();

    assertTrue(m.containsAttribute("client"));
    Client c = (Client) map.get("client");
    assertEquals(client, c);
  }
  /**
   * Test if the {@link Client} has been well updated. The following conditions are checked :<br>
   *
   * <ul>
   *   <li>The new value for the updated property can be read with the {@link ClientDAO}
   *   <li>The view is redirected to the client.html page
   * </ul>
   */
  @Test
  public void testUpdate() {
    controller.edit(m, clientId);
    Map<String, Object> map = m.asMap();
    Client c = (Client) map.get("client");

    c.setName("Sun");
    String view = controller.update(c, new MapBindingResult(Collections.emptyMap(), ""));

    assertEquals("Sun", clientDAO.findById(clientId).getName());
    assertEquals("redirect:/client.html", view);
  }