### Question:
NotificationServiceImpl implements NotificationService { @Override public boolean orderChangedSuccess(NotifyInfo info, HttpHeaders headers){ Mail mail = new Mail(); mail.setMailFrom(email); mail.setMailTo(info.getEmail()); mail.setMailSubject("Order Changed Success"); Map<String, Object> model = new HashMap<>(); model.put(username, info.getUsername()); model.put(startingPlace,info.getStartingPlace()); model.put(endPlace,info.getEndPlace()); model.put(startingTime,info.getStartingTime()); model.put("date",info.getDate()); model.put(seatClass,info.getSeatClass()); model.put(seatNumber,info.getSeatNumber()); model.put("orderNumber", info.getOrderNumber()); mail.setModel(model); try { mailService.sendEmail(mail,"order_changed_success.ftl"); return true; } catch (Exception e) { LOGGER.error(e.getMessage()); return false; } }  @Override boolean preserveSuccess(NotifyInfo info, HttpHeaders headers); @Override boolean orderCreateSuccess(NotifyInfo info, HttpHeaders headers); @Override boolean orderChangedSuccess(NotifyInfo info, HttpHeaders headers); @Override boolean orderCancelSuccess(NotifyInfo info, HttpHeaders headers);  }### Answer:
@Test public void testOrderChangedSuccess1() throws Exception { NotifyInfo info = new NotifyInfo(); Mockito.doNothing().doThrow(new RuntimeException()).when(mailService).sendEmail(Mockito.any(Mail.class), Mockito.anyString()); boolean result = notificationServiceImpl.orderChangedSuccess(info, headers); Assert.assertTrue(result); }
@Test public void testOrderChangedSuccess2() throws Exception { NotifyInfo info = new NotifyInfo(); Mockito.doThrow(new Exception()).when(mailService).sendEmail(Mockito.any(Mail.class), Mockito.anyString()); boolean result = notificationServiceImpl.orderChangedSuccess(info, headers); Assert.assertFalse(result); }