Search in sources :

Example 6 with X509Certificates

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;
        }
    };
}
Also used : X509CertificateWithInfo(com.microsoft.azure.sdk.iot.provisioning.service.configs.X509CertificateWithInfo) X509Certificates(com.microsoft.azure.sdk.iot.provisioning.service.configs.X509Certificates) Verifications(mockit.Verifications) Test(org.junit.Test)

Example 7 with X509Certificates

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());
}
Also used : X509Certificates(com.microsoft.azure.sdk.iot.provisioning.service.configs.X509Certificates) Test(org.junit.Test)

Aggregations

X509Certificates (com.microsoft.azure.sdk.iot.provisioning.service.configs.X509Certificates)7 Test (org.junit.Test)7 X509CertificateWithInfo (com.microsoft.azure.sdk.iot.provisioning.service.configs.X509CertificateWithInfo)2 NonStrictExpectations (mockit.NonStrictExpectations)2 Verifications (mockit.Verifications)2