/** * 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 testViewWithInvalidId() { controller.view(m, Long.MAX_VALUE); Map<String, Object> map = m.asMap(); assertTrue(m.containsAttribute("client")); assertNull(map.get("client")); }
/** * Test if the model contains the correct {@link Client} object. The following conditions are * checked :<br> * * <ul> * <li>The model contains an attribute called "client" * <li>The attribute "client" is equal to the {@link Client} created before in setUp() method * </ul> */ @Test public void testView() { controller.view(m, clientId); Map<String, Object> map = m.asMap(); assertTrue(m.containsAttribute("client")); Client c = (Client) map.get("client"); assertEquals(client, c); }