use of com.microsoft.azure.sdk.iot.device.IotHubSSLContext in project azure-iot-sdk-java by Azure.
the class IotHubSSLContextTest method constructorWithInvalidCertPathThrows.
@Test(expected = IOException.class)
public void constructorWithInvalidCertPathThrows() throws NoSuchAlgorithmException, KeyStoreException, KeyManagementException, IOException, CertificateException {
new Expectations() {
{
Deencapsulation.invoke(mockedDefaultCert, "setValidCertPath", anyString);
result = new FileNotFoundException();
}
};
//act
IotHubSSLContext testContext = Deencapsulation.newInstance(IotHubSSLContext.class, "/Invalid/Test/Cert/Path", true);
}
use of com.microsoft.azure.sdk.iot.device.IotHubSSLContext in project azure-iot-sdk-java by Azure.
the class DeviceClientConfigTest method getIotHubSSLContextGets.
//Tests_SRS_DEVICECLIENTCONFIG_25_032: [**The function shall return the IotHubSSLContext.**] **
@Test
public void getIotHubSSLContextGets(@Mocked final IotHubSSLContext mockedContext) throws URISyntaxException {
final String iotHubHostname = "test.iothubhostname";
final String deviceId = "test-deviceid";
final String deviceKey = "test-devicekey";
final String sharedAccessToken = null;
final String cert = "ValidCertString";
final IotHubConnectionString iotHubConnectionString = Deencapsulation.newInstance(IotHubConnectionString.class, new Class[] { String.class, String.class, String.class, String.class }, iotHubHostname, deviceId, deviceKey, sharedAccessToken);
DeviceClientConfig config = new DeviceClientConfig(iotHubConnectionString);
config.setIotHubSSLContext(mockedContext);
IotHubSSLContext testContext = config.getIotHubSSLContext();
assertNotNull(testContext);
assertEquals(testContext, mockedContext);
}
Aggregations