NotificationRegistrationDaoHelper { public NotificationRegistrationEntity getNotificationRegistration(String namespace, String name) { NotificationRegistrationEntity notificationRegistration = notificationRegistrationDao.getNotificationRegistration(namespace, name); if (notificationRegistration == null) { throw new ObjectNotFoundException("The notification registration with namespace \"" + namespace + "\" and name \"" + name + "\" was not found."); } return notificationRegistration; }  NotificationRegistrationEntity getNotificationRegistration(String namespace, String name);  }
@Test public void testGetNotificationRegistrationAssertReturnEntityWhenEntityExists() { NotificationRegistrationKey businessObjectDataNotificationRegistrationKey = new NotificationRegistrationKey(NAMESPACE, BDEF_NAME); notificationRegistrationDaoTestHelper.createBusinessObjectDataNotificationRegistrationEntity(businessObjectDataNotificationRegistrationKey, NotificationEventTypeEntity.EventTypesBdata.BUS_OBJCT_DATA_STTS_CHG.name(), NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, STORAGE_NAME, BDATA_STATUS, BDATA_STATUS, notificationRegistrationDaoTestHelper.getTestJobActions(), NotificationRegistrationStatusEntity.ENABLED); NotificationRegistrationEntity notificationRegistrationEntity = notificationRegistrationDaoHelper.getNotificationRegistration(NAMESPACE, BDEF_NAME); assertNotNull(notificationRegistrationEntity); assertEquals(NAMESPACE, notificationRegistrationEntity.getNamespace().getCode()); assertEquals(BDEF_NAME, notificationRegistrationEntity.getName()); }
@Test public void testGetNotificationRegistrationAssertThrowWhenEntityNotExist() { NotificationRegistrationKey businessObjectDataNotificationRegistrationKey = new NotificationRegistrationKey(NAMESPACE, BDEF_NAME); notificationRegistrationDaoTestHelper.createBusinessObjectDataNotificationRegistrationEntity(businessObjectDataNotificationRegistrationKey, NotificationEventTypeEntity.EventTypesBdata.BUS_OBJCT_DATA_STTS_CHG.name(), NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, STORAGE_NAME, BDATA_STATUS, BDATA_STATUS, notificationRegistrationDaoTestHelper.getTestJobActions(), NotificationRegistrationStatusEntity.ENABLED); try { notificationRegistrationDaoHelper.getNotificationRegistration(NAMESPACE, "DOES_NOT_EXIST"); fail(); } catch (Exception e) { assertEquals(ObjectNotFoundException.class, e.getClass()); assertEquals("The notification registration with namespace \"" + NAMESPACE + "\" and name \"DOES_NOT_EXIST\" was not found.", e.getMessage()); } }