NotificationRegistrationStatusDaoHelper { public NotificationRegistrationStatusEntity getNotificationRegistrationStatusEntity(String code) throws ObjectNotFoundException { NotificationRegistrationStatusEntity notificationRegistrationStatusEntity = notificationRegistrationStatusDao.getNotificationRegistrationStatus(code); if (notificationRegistrationStatusEntity == null) { throw new ObjectNotFoundException(String.format("The notification registration status \"%s\" doesn't exist.", code)); } return notificationRegistrationStatusEntity; }  NotificationRegistrationStatusEntity getNotificationRegistrationStatusEntity(String code);  }
@Test public void testGetNotificationRegistrationStatusAssertReturnEntityWhenEntityExists() { NotificationRegistrationStatusEntity notificationRegistrationStatus = notificationRegistrationStatusDaoHelper.getNotificationRegistrationStatusEntity("ENABLED"); assertNotNull(notificationRegistrationStatus); assertEquals("ENABLED", notificationRegistrationStatus.getCode()); }
@Test public void testGetNotificationRegistrationStatusAssertThrowWhenEntityNotExist() { try { notificationRegistrationStatusDaoHelper.getNotificationRegistrationStatusEntity("DOES_NOT_EXIST"); fail(); } catch (Exception e) { assertEquals(ObjectNotFoundException.class, e.getClass()); assertEquals("The notification registration status \"DOES_NOT_EXIST\" doesn't exist.", e.getMessage()); } }