/** * Test if the {@link Client} has been well deleted. The following conditions are checked :<br> * * <ul> * <li>The deleted {@link Client} can't be found with the {@link ClientDAO} * <li>The view is redirected to the client.html page * </ul> */ @Test public void testDelete() { String view = controller.delete(clientId); Client client = clientDAO.findById(clientId); assertFalse(client.isEnabled()); assertEquals("redirect:/client.html", view); }
/** Test if the deletion throw a {@link NullPointerException} by passing an invalid ID argument */ @Test(expected = NullPointerException.class) public void testDeleteWithInvalidId() { controller.delete(Long.MAX_VALUE); }