use of com.microsoft.azure.sdk.iot.provisioning.service.configs.X509CertificateWithInfo 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.X509CertificateWithInfo in project azure-iot-sdk-java by Azure.
the class X509CertificateWithInfoTest method constructorCopyCertificate.
/* SRS_X509_CERTIFICATE_WITH_INFO_21_004: [The constructor shall copy the certificate form the provided x509CertificateWithInfo.] */
@Test
public void constructorCopyCertificate() {
// arrange
X509CertificateWithInfo x509CertificateWithInfo = Deencapsulation.newInstance(X509CertificateWithInfo.class, new Class[] { String.class }, PUBLIC_CERTIFICATE_STRING);
// act
X509CertificateWithInfo x509CertificateWithInfoCopy = new X509CertificateWithInfo(x509CertificateWithInfo);
// assert
assertEquals(PUBLIC_CERTIFICATE_STRING, Deencapsulation.getField(x509CertificateWithInfoCopy, "certificate"));
assertNull(Deencapsulation.getField(x509CertificateWithInfoCopy, "info"));
}
use of com.microsoft.azure.sdk.iot.provisioning.service.configs.X509CertificateWithInfo in project azure-iot-sdk-java by Azure.
the class X509CertificateWithInfoTest method constructorCopyInfo.
/* SRS_X509_CERTIFICATE_WITH_INFO_21_005: [If the provide x509CertificateWithInfo contains `info`, the constructor shall create a new instance of the X509CertificateInfo with the provided `info`.] */
@Test
public void constructorCopyInfo(@Mocked final X509CertificateInfo mockedX509CertificateInfo) throws IllegalArgumentException {
// arrange
X509CertificateWithInfo x509CertificateWithInfo = Deencapsulation.newInstance(X509CertificateWithInfo.class);
Deencapsulation.setField(x509CertificateWithInfo, "info", mockedX509CertificateInfo);
// act
X509CertificateWithInfo x509CertificateWithInfoCopy = new X509CertificateWithInfo(x509CertificateWithInfo);
// assert
assertNull(Deencapsulation.getField(x509CertificateWithInfoCopy, "certificate"));
assertNotNull(Deencapsulation.getField(x509CertificateWithInfoCopy, "info"));
}
Aggregations