Search in sources :

Example 1 with CertPolicyDaoImpl

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

the class CertPolicyDaoBase_getPolicyGroupsByDomainTest method testGetPolicyGroupsByDomain_noEntityManager_assertException.

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

Example 2 with CertPolicyDaoImpl

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

the class CertPolicyDaoImpl_addPolicyGroupTest method testAddPolicyGroup_noEntityManager_assertException.

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

Example 3 with CertPolicyDaoImpl

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

the class CertPolicyDaoImpl_addPolicyTest method testAddPolicy_noEntityManager_assertException.

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

Example 4 with CertPolicyDaoImpl

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

the class CertPolicyDaoImpl_getPolicyGroupByNameTest method testGetPolicyGroupByName_noEntityManager_assertException.

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

Example 5 with CertPolicyDaoImpl

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

the class CertPolicyDaoImpl_getPolicyGroupByNameTest method testGetPolicyGroupByName_exceptionInQuery_assertException.

@Test
public void testGetPolicyGroupByName_exceptionInQuery_assertException() {
    final EntityManager manager = mock(EntityManager.class);
    doThrow(new RuntimeException("Just Passing Through")).when(manager).createQuery((String) any());
    final CertPolicyDaoImpl dao = new CertPolicyDaoImpl();
    dao.setEntityManager(manager);
    boolean exceptionOccured = false;
    try {
        dao.getPolicyGroupByName("any");
    } catch (ConfigurationStoreException ex) {
        exceptionOccured = true;
    }
    assertTrue(exceptionOccured);
}
Also used : EntityManager(javax.persistence.EntityManager) CertPolicyDaoImpl(org.nhindirect.config.store.dao.impl.CertPolicyDaoImpl) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)44 CertPolicyDaoImpl (org.nhindirect.config.store.dao.impl.CertPolicyDaoImpl)44 EntityManager (javax.persistence.EntityManager)24 DomainDao (org.nhindirect.config.store.dao.DomainDao)10 Query (javax.persistence.Query)8 NoResultException (javax.persistence.NoResultException)3