use of org.nhindirect.monitor.dao.AggregationDAOException in project nhin-d by DirectProject.
the class AggregationDAOImpl_addUpdateAggregationTest method testAddUpdateAggregationTest_emptyRepository_addNon0Version_assertException.
@Test
public void testAddUpdateAggregationTest_emptyRepository_addNon0Version_assertException() throws Exception {
final Aggregation insert = new Aggregation();
insert.setExchangeBlob(new byte[] { 0, 3, 2 });
insert.setId("12345");
insert.setVersion(1);
boolean exceptionOccured = false;
try {
notifDao.addUpdateAggregation(insert);
} catch (AggregationDAOException e) {
exceptionOccured = true;
}
assertTrue(exceptionOccured);
final Aggregation aggr = notifDao.getAggregation("12345");
assertNull(aggr);
}
use of org.nhindirect.monitor.dao.AggregationDAOException in project nhin-d by DirectProject.
the class AggregationDAOImpl_confirmAggregationTest method testConfirmAggregationTest_exceptionInRemove_assertException.
@Test
public void testConfirmAggregationTest_exceptionInRemove_assertException() throws Exception {
EntityManager mgr = mock(EntityManager.class);
doThrow(new RuntimeException()).when(mgr).find((Class<?>) any(), any());
final AggregationDAOImpl dao = new AggregationDAOImpl();
dao.setEntityManager(mgr);
boolean exceptionOccured = false;
try {
dao.confirmAggregation("12345");
} catch (AggregationDAOException e) {
exceptionOccured = true;
}
assertTrue(exceptionOccured);
}
Aggregations