use of com.microsoft.azure.sdk.iot.deps.serializer.X509ThumbprintParser in project azure-iot-sdk-java by Azure.
the class X509ThumbprintParserTest method testToJson.
// Tests_SRS_X509ThumbprintParser_34_007: [This method shall return a json representation of this.]
@Test
public void testToJson() {
// arrange
String expectedJson = "{\"primaryThumbprint\":\"" + SAMPLE_THUMBPRINT1 + "\",\"secondaryThumbprint\":\"" + SAMPLE_THUMBPRINT2 + "\"}";
X509ThumbprintParser parser = new X509ThumbprintParser(SAMPLE_THUMBPRINT1, SAMPLE_THUMBPRINT2);
// act
String actualJson = parser.toJson();
// assert
assertEquals(expectedJson, actualJson);
}
use of com.microsoft.azure.sdk.iot.deps.serializer.X509ThumbprintParser in project azure-iot-sdk-java by Azure.
the class X509ThumbprintParserTest method testFromJson.
// Tests_SRS_X509ThumbprintParser_34_009: [The parser shall create and return an instance of a X509ThumbprintParser object based off the provided json.]
@Test
public void testFromJson() {
// arrange
String json = "{\"primaryThumbprint\":\"" + SAMPLE_THUMBPRINT1 + "\",\"secondaryThumbprint\":\"" + SAMPLE_THUMBPRINT2 + "\"}";
// act
X509ThumbprintParser parser = new X509ThumbprintParser(json);
// assert
String actualPrimaryThumbprint = Deencapsulation.getField(parser, "primaryThumbprint");
String actualSecondaryThumbprint = Deencapsulation.getField(parser, "secondaryThumbprint");
assertEquals(SAMPLE_THUMBPRINT1, actualPrimaryThumbprint);
assertEquals(SAMPLE_THUMBPRINT2, actualSecondaryThumbprint);
}
Aggregations