use of org.nhindirect.config.service.impl.CertificateServiceImpl in project nhin-d by DirectProject.
the class CertificateServiceTest method testGetCertificatesForOwner.
/**
* Test the getCertificatesForOwner method.
*/
public void testGetCertificatesForOwner() {
final CertificateDao certificateDao = context.mock(CertificateDao.class);
final String owner = "beau";
final CertificateGetOptions certificateOptions = CertificateGetOptions.DEFAULT;
context.checking(new Expectations() {
{
oneOf(certificateDao).list(owner);
will(returnValue(Collections.<Certificate>emptyList()));
}
});
CertificateServiceImpl service = new CertificateServiceImpl();
service.setDao(certificateDao);
try {
Collection<Certificate> output = service.getCertificatesForOwner(owner, certificateOptions);
assertNotNull("Output is null when using valid params", output);
assertEquals("Output does not match mocked return value when using valid params", Collections.<Certificate>emptyList(), output);
} catch (Exception e) {
fail("Exception thrown");
}
}
use of org.nhindirect.config.service.impl.CertificateServiceImpl in project nhin-d by DirectProject.
the class CertificateServiceTest method testRemoveCertificatesForOwner.
/**
* Test the removeCertificatesForOwner method.
*/
public void testRemoveCertificatesForOwner() {
final CertificateDao certificateDao = context.mock(CertificateDao.class);
final String owner = "beau";
context.checking(new Expectations() {
{
oneOf(certificateDao).delete(owner);
}
});
CertificateServiceImpl service = new CertificateServiceImpl();
service.setDao(certificateDao);
try {
service.removeCertificatesForOwner(owner);
} catch (Exception e) {
fail("Exception thrown");
}
}
use of org.nhindirect.config.service.impl.CertificateServiceImpl in project nhin-d by DirectProject.
the class CertificateServiceTest method testGetCertificates.
/**
* Test the getCertificates method.
*/
public void testGetCertificates() {
final CertificateDao certificateDao = context.mock(CertificateDao.class);
final Collection<Long> certificateIds = Arrays.asList(7L, 8L);
final CertificateGetOptions certificateOptions = CertificateGetOptions.DEFAULT;
context.checking(new Expectations() {
{
oneOf(certificateDao).list(new ArrayList<Long>(certificateIds));
will(returnValue(Collections.<Certificate>emptyList()));
}
});
CertificateServiceImpl service = new CertificateServiceImpl();
service.setDao(certificateDao);
try {
Collection<Certificate> output = service.getCertificates(certificateIds, certificateOptions);
assertEquals("Output does not match expected", Collections.<Certificate>emptyList(), output);
} catch (Exception e) {
fail("Exception thrown");
}
}
Aggregations