use of com.microsoft.azure.sdk.iot.provisioning.service.configs.X509Certificates in project azure-iot-sdk-java by Azure.
the class X509CertificatesTest method constructorCopiesPrimaryAndSecondaryCertsSucceed.
/* SRS_X509_CERTIFICATES_21_006: [If the secondary certificate is not null, the constructor shall create a new instance of the X509CertificateWithInfo using the provided secondary certificate, and store it as the secondary Certificate.] */
@Test
public void constructorCopiesPrimaryAndSecondaryCertsSucceed(@Mocked final X509CertificateWithInfo mockedX509CertificateWithInfo) throws IllegalArgumentException {
// arrange
X509Certificates x509Certificates = Deencapsulation.newInstance(X509Certificates.class, new Class[] { String.class, String.class }, PUBLIC_CERTIFICATE_STRING, PUBLIC_CERTIFICATE_STRING);
// act
X509Certificates x509CertificatesCopy = new X509Certificates(x509Certificates);
// assert
assertNotNull(Deencapsulation.getField(x509CertificatesCopy, "primary"));
assertNotNull(Deencapsulation.getField(x509CertificatesCopy, "secondary"));
new Verifications() {
{
new X509CertificateWithInfo((X509CertificateWithInfo) any);
times = 2;
}
};
}
use of com.microsoft.azure.sdk.iot.provisioning.service.configs.X509Certificates in project azure-iot-sdk-java by Azure.
the class X509CertificatesTest method gettersSucceed.
/* SRS_X509_CERTIFICATES_21_007: [The getPrimary shall return the stored primary.] */
/* SRS_X509_CERTIFICATES_21_008: [The getSecondary shall return the stored secondary.] */
@Test
public void gettersSucceed(@Mocked final X509CertificateWithInfo mockedX509CertificateWithInfo) throws IllegalArgumentException {
// arrange
X509Certificates x509Certificates = Deencapsulation.newInstance(X509Certificates.class, new Class[] { String.class, String.class }, PUBLIC_CERTIFICATE_STRING, PUBLIC_CERTIFICATE_STRING);
// act - assert
assertNotNull(x509Certificates.getPrimaryFinal());
assertNotNull(x509Certificates.getSecondaryFinal());
}
Aggregations