use of com.microsoft.azure.sdk.iot.deps.serializer.SymmetricKeyParser in project azure-iot-sdk-java by Azure.
the class SymmetricKeyParserTest method testConstructorWithKeys.
// Tests_SRS_SymmetricKeyParser_34_008: [This constructor shall create and return an instance of a SymmetricKeyParser object that holds the provided primary and secondary keys.]
@Test
public void testConstructorWithKeys() {
// act
SymmetricKeyParser parser = new SymmetricKeyParser(TEST_KEY1, TEST_KEY2);
// assert
String actualPrimaryKey = Deencapsulation.getField(parser, "primaryKey");
String actualSecondaryKey = Deencapsulation.getField(parser, "secondaryKey");
assertEquals(TEST_KEY1, actualPrimaryKey);
assertEquals(TEST_KEY2, actualSecondaryKey);
}
use of com.microsoft.azure.sdk.iot.deps.serializer.SymmetricKeyParser in project azure-iot-sdk-java by Azure.
the class SymmetricKeyParserTest method testConstructorWithJson.
// Tests_SRS_SymmetricKeyParser_34_009: [This constructor shall create and return an instance of a SymmetricKeyParser object based off the provided json.]
@Test
public void testConstructorWithJson() {
// arrange
String json = "{\"primaryKey\":\"" + TEST_KEY1 + "\",\"secondaryKey\":\"" + TEST_KEY2 + "\"}";
// act
SymmetricKeyParser parser = new SymmetricKeyParser(json);
// assert
assertEquals(TEST_KEY1, parser.getPrimaryKeyFinal());
assertEquals(TEST_KEY2, parser.getSecondaryKeyFinal());
}
use of com.microsoft.azure.sdk.iot.deps.serializer.SymmetricKeyParser in project azure-iot-sdk-java by Azure.
the class SymmetricKeyParserTest method setPrimaryKeyNullValueThrowsIllegalArgumentException.
// Tests_SRS_SymmetricKeyParser_34_002: [If the provided primaryKey value is null, an IllegalArgumentException shall be thrown.]
@Test(expected = IllegalArgumentException.class)
public void setPrimaryKeyNullValueThrowsIllegalArgumentException() {
// arrange
SymmetricKeyParser parser = new SymmetricKeyParser("", "");
// act
parser.setPrimaryKey(null);
}
use of com.microsoft.azure.sdk.iot.deps.serializer.SymmetricKeyParser in project azure-iot-sdk-java by Azure.
the class AuthenticationParserTest method testSymmetricKeyParserProperty.
// Tests_SRS_AUTHENTICATION_PARSER_34_006: [This method shall return the value of this object's symmetricKey.]
// Tests_SRS_AUTHENTICATION_PARSER_34_007: [This method shall set the value of symmetricKey equal to the provided value.]
@Test
public void testSymmetricKeyParserProperty() {
// arrange
AuthenticationParser parser = new AuthenticationParser();
SymmetricKeyParser symmetricKeyParser = new SymmetricKeyParser();
symmetricKeyParser.setPrimaryKey("1234");
symmetricKeyParser.setPrimaryKey("5678");
// act
parser.setSymmetricKey(symmetricKeyParser);
// assert
assertEquals(symmetricKeyParser, parser.getSymmetricKey());
}
Aggregations