logger.info("> updateGreeting id:{}", greeting.getId()); Greeting updatedGreeting = greetingService.update(greeting); if (updatedGreeting == null) { return new ResponseEntity<Greeting>(
logger.info("> updateGreeting id:{}", greeting.getId()); Greeting updatedGreeting = greetingService.update(greeting); if (updatedGreeting == null) { return new ResponseEntity<Greeting>(
@Test public void testUpdateNotFound() { Exception exception = null; Greeting entity = new Greeting(); entity.setId(Long.MAX_VALUE); entity.setText("test"); try { service.update(entity); } catch (NoResultException e) { exception = e; } Assert.assertNotNull("failure - expected exception", exception); Assert.assertTrue("failure - expected NoResultException", exception instanceof NoResultException); }
@Test public void testUpdate() { Long id = new Long(1); Greeting entity = service.findOne(id); Assert.assertNotNull("failure - expected not null", entity); String updatedText = entity.getText() + " test"; entity.setText(updatedText); Greeting updatedEntity = service.update(entity); Assert.assertNotNull("failure - expected not null", updatedEntity); Assert.assertEquals("failure - expected id attribute match", id, updatedEntity.getId()); Assert.assertEquals("failure - expected text attribute match", updatedText, updatedEntity.getText()); }