Search in sources :

Example 6 with DuplicateNotificationStateManagerException

use of org.nhindirect.monitor.processor.DuplicateNotificationStateManagerException in project nhin-d by DirectProject.

the class DefaultDuplicateNotificationStateManager_addNotificationTest method testAddNotification_daoError_assertException.

@Test
public void testAddNotification_daoError_assertException() throws Exception {
    DefaultDuplicateNotificationStateManager mgr = new DefaultDuplicateNotificationStateManager();
    boolean execptionOccured = false;
    NotificationDuplicationDAO spyDao = mock(NotificationDuplicationDAO.class);
    doThrow(new NotificationDAOException("")).when(spyDao).addNotification((String) any(), (String) any());
    mgr.setDao(spyDao);
    try {
        Tx tx = TestUtils.makeMessage(TxMessageType.DSN, "1234", "5678", "", "", "gm2552@cerner.com,ah4626@cerner.com");
        mgr.addNotification(tx);
    } catch (DuplicateNotificationStateManagerException e) {
        execptionOccured = true;
    }
    assertTrue(execptionOccured);
}
Also used : Tx(org.nhindirect.common.tx.model.Tx) NotificationDAOException(org.nhindirect.monitor.dao.NotificationDAOException) NotificationDuplicationDAO(org.nhindirect.monitor.dao.NotificationDuplicationDAO) DuplicateNotificationStateManagerException(org.nhindirect.monitor.processor.DuplicateNotificationStateManagerException) Test(org.junit.Test)

Aggregations

DuplicateNotificationStateManagerException (org.nhindirect.monitor.processor.DuplicateNotificationStateManagerException)6 NotificationDAOException (org.nhindirect.monitor.dao.NotificationDAOException)5 Test (org.junit.Test)3 Tx (org.nhindirect.common.tx.model.Tx)3 TxDetail (org.nhindirect.common.tx.model.TxDetail)3 TxMessageType (org.nhindirect.common.tx.model.TxMessageType)3 NotificationDuplicationDAO (org.nhindirect.monitor.dao.NotificationDuplicationDAO)2 Response (javax.ws.rs.core.Response)1 DuplicateNotificationStateManager (org.nhindirect.monitor.processor.DuplicateNotificationStateManager)1