use of com.microsoft.azure.sdk.iot.provisioning.service.configs.X509CertificateWithInfo in project azure-iot-sdk-java by Azure.
the class X509CertificateWithInfoTest method emptyConstructorSucceed.
/* SRS_X509_CERTIFICATE_WITH_INFO_21_008: [The X509CertificateWithInfo shall provide an empty constructor to make GSON happy.] */
@Test
public void emptyConstructorSucceed() {
// arrange
// act
X509CertificateWithInfo x509CertificateWithInfo = Deencapsulation.newInstance(X509CertificateWithInfo.class);
// assert
assertNotNull(x509CertificateWithInfo);
}
use of com.microsoft.azure.sdk.iot.provisioning.service.configs.X509CertificateWithInfo in project azure-iot-sdk-java by Azure.
the class X509CertificateWithInfoTest method constructorStoresCertificate.
/* SRS_X509_CERTIFICATE_WITH_INFO_21_002: [The constructor shall store the provided certificate and set info as null.] */
@Test
public void constructorStoresCertificate() {
// arrange
// act
X509CertificateWithInfo x509CertificateWithInfo = Deencapsulation.newInstance(X509CertificateWithInfo.class, new Class[] { String.class }, PUBLIC_CERTIFICATE_STRING);
// assert
assertEquals(PUBLIC_CERTIFICATE_STRING, Deencapsulation.getField(x509CertificateWithInfo, "certificate"));
assertNull(Deencapsulation.getField(x509CertificateWithInfo, "info"));
}
use of com.microsoft.azure.sdk.iot.provisioning.service.configs.X509CertificateWithInfo in project azure-iot-sdk-java by Azure.
the class X509CertificateWithInfoTest method gettersSucceed.
/* SRS_X509_CERTIFICATE_WITH_INFO_21_006: [The getCertificate shall return the stored certificate.] */
/* SRS_X509_CERTIFICATE_WITH_INFO_21_007: [The getInfo shall return the stored info.] */
@Test
public void gettersSucceed(@Mocked final X509CertificateInfo mockedX509CertificateInfo) throws IllegalArgumentException {
// arrange
X509CertificateWithInfo x509CertificateWithInfo = Deencapsulation.newInstance(X509CertificateWithInfo.class, new Class[] { String.class }, PUBLIC_CERTIFICATE_STRING);
Deencapsulation.setField(x509CertificateWithInfo, "info", mockedX509CertificateInfo);
// act
X509CertificateWithInfo x509CertificateWithInfoCopy = new X509CertificateWithInfo(x509CertificateWithInfo);
// assert
assertEquals(PUBLIC_CERTIFICATE_STRING, x509CertificateWithInfoCopy.getCertificate());
assertNotNull(x509CertificateWithInfoCopy.getInfo());
}
use of com.microsoft.azure.sdk.iot.provisioning.service.configs.X509CertificateWithInfo in project azure-iot-sdk-java by Azure.
the class X509CertificateWithInfoTest method constructorCopyCertificateAndInfo.
/* SRS_X509_CERTIFICATE_WITH_INFO_21_004: [The constructor shall copy the certificate form the provided x509CertificateWithInfo.] */
/* 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 constructorCopyCertificateAndInfo(@Mocked final X509CertificateInfo mockedX509CertificateInfo) throws IllegalArgumentException {
// arrange
X509CertificateWithInfo x509CertificateWithInfo = Deencapsulation.newInstance(X509CertificateWithInfo.class, new Class[] { String.class }, PUBLIC_CERTIFICATE_STRING);
Deencapsulation.setField(x509CertificateWithInfo, "info", mockedX509CertificateInfo);
// act
X509CertificateWithInfo x509CertificateWithInfoCopy = new X509CertificateWithInfo(x509CertificateWithInfo);
// assert
assertEquals(PUBLIC_CERTIFICATE_STRING, Deencapsulation.getField(x509CertificateWithInfoCopy, "certificate"));
assertNotNull(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 X509CertificatesTest method constructorCopiesPrimaryCertSucceed.
/* SRS_X509_CERTIFICATES_21_005: [The constructor shall create a new instance of X509CertificateWithInfo using the primary certificate on the provided x509Certificates.] */
/* 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 constructorCopiesPrimaryCertSucceed(@Mocked final X509CertificateWithInfo mockedX509CertificateWithInfo) throws IllegalArgumentException {
// arrange
X509Certificates x509Certificates = Deencapsulation.newInstance(X509Certificates.class, new Class[] { String.class, String.class }, PUBLIC_CERTIFICATE_STRING, null);
// act
X509Certificates x509CertificatesCopy = new X509Certificates(x509Certificates);
// assert
assertNotNull(Deencapsulation.getField(x509CertificatesCopy, "primary"));
assertNull(Deencapsulation.getField(x509CertificatesCopy, "secondary"));
new Verifications() {
{
new X509CertificateWithInfo((X509CertificateWithInfo) any);
times = 1;
}
};
}
Aggregations