use of org.nhindirect.policy.x509.CertificatePolicyCpsUriExtensionField in project nhin-d by DirectProject.
the class CertificatePolicyCpsUriExtensionField_injectReferenceValueTest method testInjectRefereneValue_policyQualUriNotExist_required_assertException.
public void testInjectRefereneValue_policyQualUriNotExist_required_assertException() throws Exception {
final X509Certificate cert = TestUtils.loadCertificate("altNameOnly.der");
final CertificatePolicyCpsUriExtensionField field = new CertificatePolicyCpsUriExtensionField(true);
boolean exceptionOccured = false;
try {
field.injectReferenceValue(cert);
} catch (PolicyRequiredException e) {
exceptionOccured = true;
}
assertTrue(exceptionOccured);
}
use of org.nhindirect.policy.x509.CertificatePolicyCpsUriExtensionField in project nhin-d by DirectProject.
the class CertificatePolicyCpsUriExtensionField_injectReferenceValueTest method testInjectRefereneValue_policyQualUriExists_assertValue.
public void testInjectRefereneValue_policyQualUriExists_assertValue() throws Exception {
final X509Certificate cert = TestUtils.loadCertificate("CernerDirectProviderCA.der");
final CertificatePolicyCpsUriExtensionField field = new CertificatePolicyCpsUriExtensionField(false);
field.injectReferenceValue(cert);
Collection<String> pols = field.getPolicyValue().getPolicyValue();
assertTrue(pols.contains("http://www.cerner.com/CPS"));
}
use of org.nhindirect.policy.x509.CertificatePolicyCpsUriExtensionField in project nhin-d by DirectProject.
the class CertificatePolicyCpsUriExtensionField_injectReferenceValueTest method testInjectRefereneValue_policyQualUriDoesNotExist_notRequired_assertValueEmpty.
public void testInjectRefereneValue_policyQualUriDoesNotExist_notRequired_assertValueEmpty() throws Exception {
final X509Certificate cert = TestUtils.loadCertificate("altNameOnly.der");
final CertificatePolicyCpsUriExtensionField field = new CertificatePolicyCpsUriExtensionField(false);
field.injectReferenceValue(cert);
assertTrue(field.getPolicyValue().getPolicyValue().isEmpty());
}
use of org.nhindirect.policy.x509.CertificatePolicyCpsUriExtensionField in project nhin-d by DirectProject.
the class CertificatePolicyCpsUriExtensionField_injectReferenceValueTest method testInjectRefereneValue_policyQualUriExistsAndRequired_assertValue.
public void testInjectRefereneValue_policyQualUriExistsAndRequired_assertValue() throws Exception {
final X509Certificate cert = TestUtils.loadCertificate("CernerDirectProviderCA.der");
final CertificatePolicyCpsUriExtensionField field = new CertificatePolicyCpsUriExtensionField(true);
field.injectReferenceValue(cert);
Collection<String> pols = field.getPolicyValue().getPolicyValue();
assertTrue(pols.contains("http://www.cerner.com/CPS"));
}
use of org.nhindirect.policy.x509.CertificatePolicyCpsUriExtensionField in project nhin-d by DirectProject.
the class CertificatePolicyCpsUriExtensionField_injectReferenceValueTest method testInjectRefereneValue_noInjection_getPolicyValue_assertException.
public void testInjectRefereneValue_noInjection_getPolicyValue_assertException() throws Exception {
final CertificatePolicyCpsUriExtensionField field = new CertificatePolicyCpsUriExtensionField(true);
boolean exceptionOccured = false;
try {
field.getPolicyValue();
} catch (IllegalStateException e) {
exceptionOccured = true;
}
assertTrue(exceptionOccured);
}
Aggregations