Search in sources :

Example 6 with TrustBundleDaoImpl

use of org.nhindirect.config.store.dao.impl.TrustBundleDaoImpl in project nhin-d by DirectProject.

the class TrustBundleDaoImpl_disassociateTrustBundlesFromDomainTest method testDisassociateTrustBundlesFromDomain_noEntityManager_assertException.

@Test
public void testDisassociateTrustBundlesFromDomain_noEntityManager_assertException() {
    final TrustBundleDaoImpl dao = new TrustBundleDaoImpl();
    boolean exceptionOccured = false;
    try {
        dao.disassociateTrustBundlesFromDomain(1234);
    } catch (IllegalStateException ex) {
        exceptionOccured = true;
    }
    assertTrue(exceptionOccured);
}
Also used : TrustBundleDaoImpl(org.nhindirect.config.store.dao.impl.TrustBundleDaoImpl) Test(org.junit.Test)

Example 7 with TrustBundleDaoImpl

use of org.nhindirect.config.store.dao.impl.TrustBundleDaoImpl in project nhin-d by DirectProject.

the class TrustBundleDaoImpl_getBundlesTest method testGetTrustBundles_noEntityManager_assertException.

@Test
public void testGetTrustBundles_noEntityManager_assertException() {
    final TrustBundleDaoImpl dao = new TrustBundleDaoImpl();
    boolean exceptionOccured = false;
    try {
        dao.getTrustBundles();
    } catch (IllegalStateException ex) {
        exceptionOccured = true;
    }
    assertTrue(exceptionOccured);
}
Also used : TrustBundleDaoImpl(org.nhindirect.config.store.dao.impl.TrustBundleDaoImpl) Test(org.junit.Test)

Example 8 with TrustBundleDaoImpl

use of org.nhindirect.config.store.dao.impl.TrustBundleDaoImpl in project nhin-d by DirectProject.

the class TrustBundleDaoImpl_getBundlesTest method testGetTrustBundles_exceptionInQuery_assertException.

@Test
public void testGetTrustBundles_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.getTrustBundles();
    } catch (ConfigurationStoreException ex) {
        exceptionOccured = true;
    }
    assertTrue(exceptionOccured);
}
Also used : EntityManager(javax.persistence.EntityManager) TrustBundleDaoImpl(org.nhindirect.config.store.dao.impl.TrustBundleDaoImpl) Test(org.junit.Test)

Example 9 with TrustBundleDaoImpl

use of org.nhindirect.config.store.dao.impl.TrustBundleDaoImpl in project nhin-d by DirectProject.

the class TrustBundleDaoImpl_getTrustBundleByIdTest method testGetTrustBundleById_noEntityManager_assertException.

@Test
public void testGetTrustBundleById_noEntityManager_assertException() {
    final TrustBundleDaoImpl dao = new TrustBundleDaoImpl();
    boolean exceptionOccured = false;
    try {
        dao.getTrustBundleById(1234);
    } catch (IllegalStateException ex) {
        exceptionOccured = true;
    }
    assertTrue(exceptionOccured);
}
Also used : TrustBundleDaoImpl(org.nhindirect.config.store.dao.impl.TrustBundleDaoImpl) Test(org.junit.Test)

Example 10 with TrustBundleDaoImpl

use of org.nhindirect.config.store.dao.impl.TrustBundleDaoImpl in project nhin-d by DirectProject.

the class TrustBundleDaoImpl_getTrustBundleByIdTest method testGetTrustBundleById_exceptionInQuery_assertException.

@Test
public void testGetTrustBundleById_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.getTrustBundleById(1234);
    } catch (ConfigurationStoreException ex) {
        exceptionOccured = true;
    }
    assertTrue(exceptionOccured);
}
Also used : EntityManager(javax.persistence.EntityManager) TrustBundleDaoImpl(org.nhindirect.config.store.dao.impl.TrustBundleDaoImpl) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)34 TrustBundleDaoImpl (org.nhindirect.config.store.dao.impl.TrustBundleDaoImpl)34 EntityManager (javax.persistence.EntityManager)19 DomainDao (org.nhindirect.config.store.dao.DomainDao)10 Query (javax.persistence.Query)7 Calendar (java.util.Calendar)2 NoResultException (javax.persistence.NoResultException)2