use of org.nhindirect.config.store.dao.impl.TrustBundleDaoImpl in project nhin-d by DirectProject.
the class TrustBundleDaoImpl_getTrustBundleByNameTest method testGetTrustBundleByName_exceptionInQuery_assertException.
@Test
public void testGetTrustBundleByName_exceptionInQuery_assertException() {
final EntityManager manager = mock(EntityManager.class);
doThrow(new RuntimeException("Just Passing Through")).when(manager).createQuery((String) any());
final TrustBundleDaoImpl dao = new TrustBundleDaoImpl();
dao.setEntityManager(manager);
boolean exceptionOccured = false;
try {
dao.getTrustBundleByName("any");
} catch (ConfigurationStoreException ex) {
exceptionOccured = true;
}
assertTrue(exceptionOccured);
}
use of org.nhindirect.config.store.dao.impl.TrustBundleDaoImpl in project nhin-d by DirectProject.
the class TrustBundleDaoImpl_getTrustBundleByNameTest method testGetTrustBundleByName_noEntityManager_assertException.
@Test
public void testGetTrustBundleByName_noEntityManager_assertException() {
final TrustBundleDaoImpl dao = new TrustBundleDaoImpl();
boolean exceptionOccured = false;
try {
dao.getTrustBundleByName("any");
} catch (IllegalStateException ex) {
exceptionOccured = true;
}
assertTrue(exceptionOccured);
}
use of org.nhindirect.config.store.dao.impl.TrustBundleDaoImpl in project nhin-d by DirectProject.
the class TrustBundleDaoImpl_addTrustBundleTest method testAddTrustBundle_noEntityManager_assertException.
@Test
public void testAddTrustBundle_noEntityManager_assertException() {
final TrustBundleDaoImpl dao = new TrustBundleDaoImpl();
boolean exceptionOccured = false;
try {
dao.addTrustBundle(new TrustBundle());
} catch (IllegalStateException ex) {
exceptionOccured = true;
}
assertTrue(exceptionOccured);
}
use of org.nhindirect.config.store.dao.impl.TrustBundleDaoImpl in project nhin-d by DirectProject.
the class TrustBundleDaoImpl_associateTrustBundleToDomainTest method testAssociateTrustBundleToDomain_unknownDomain_assertException.
@Test
public void testAssociateTrustBundleToDomain_unknownDomain_assertException() {
boolean exceptionOccured = false;
final EntityManager mgr = mock(EntityManager.class);
final DomainDao domainDao = mock(DomainDao.class);
final TrustBundleDaoImpl dao = new TrustBundleDaoImpl();
dao.setDomainDao(domainDao);
dao.setEntityManager(mgr);
TrustBundleDaoImpl spyDao = spy(dao);
try {
spyDao.associateTrustBundleToDomain(1234, 5678, true, true);
} catch (ConfigurationStoreException e) {
exceptionOccured = true;
}
assertTrue(exceptionOccured);
verify(domainDao, times(1)).getDomain(new Long(1234));
verify(spyDao, never()).getTrustBundleById(5678);
}
use of org.nhindirect.config.store.dao.impl.TrustBundleDaoImpl in project nhin-d by DirectProject.
the class TrustBundleDaoImpl_associateTrustBundleToDomainTest method testAssociateTrustBundleToDomain_noEntityManager_assertException.
@Test
public void testAssociateTrustBundleToDomain_noEntityManager_assertException() {
final TrustBundleDaoImpl dao = new TrustBundleDaoImpl();
boolean exceptionOccured = false;
try {
dao.associateTrustBundleToDomain(1234, 5678, true, true);
} catch (IllegalStateException ex) {
exceptionOccured = true;
}
assertTrue(exceptionOccured);
}
Aggregations