// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.recoveryservices.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.recoveryservices.models.ResourceCertificateAndAadDetails;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;

public final class ResourceCertificateAndAadDetailsTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ResourceCertificateAndAadDetails model =
            BinaryData
                .fromString(
                    "{\"authType\":\"AzureActiveDirectory\",\"aadAuthority\":\"zwfqkqujidsuyon\",\"aadTenantId\":\"bglaocqxtccm\",\"servicePrincipalClientId\":\"yudxytlmoy\",\"servicePrincipalObjectId\":\"xv\",\"azureManagementEndpointAudience\":\"fudwpznt\",\"serviceResourceId\":\"dzhlrq\",\"aadAudience\":\"hckfrlhrx\",\"friendlyName\":\"yvpycanuzbpzk\",\"issuer\":\"kuwbcrnwb\",\"resourceId\":6623927452976835179,\"subject\":\"eyvjusrtslhspkde\",\"thumbprint\":\"aofmxagkvtme\",\"validFrom\":\"2020-12-28T20:08:12Z\",\"validTo\":\"2021-06-04T11:35:51Z\"}")
                .toObject(ResourceCertificateAndAadDetails.class);
        Assertions.assertEquals("yvpycanuzbpzk", model.friendlyName());
        Assertions.assertEquals("kuwbcrnwb", model.issuer());
        Assertions.assertEquals(6623927452976835179L, model.resourceId());
        Assertions.assertEquals("eyvjusrtslhspkde", model.subject());
        Assertions.assertEquals("aofmxagkvtme", model.thumbprint());
        Assertions.assertEquals(OffsetDateTime.parse("2020-12-28T20:08:12Z"), model.validFrom());
        Assertions.assertEquals(OffsetDateTime.parse("2021-06-04T11:35:51Z"), model.validTo());
        Assertions.assertEquals("zwfqkqujidsuyon", model.aadAuthority());
        Assertions.assertEquals("bglaocqxtccm", model.aadTenantId());
        Assertions.assertEquals("yudxytlmoy", model.servicePrincipalClientId());
        Assertions.assertEquals("xv", model.servicePrincipalObjectId());
        Assertions.assertEquals("fudwpznt", model.azureManagementEndpointAudience());
        Assertions.assertEquals("dzhlrq", model.serviceResourceId());
        Assertions.assertEquals("hckfrlhrx", model.aadAudience());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ResourceCertificateAndAadDetails model =
            new ResourceCertificateAndAadDetails()
                .withFriendlyName("yvpycanuzbpzk")
                .withIssuer("kuwbcrnwb")
                .withResourceId(6623927452976835179L)
                .withSubject("eyvjusrtslhspkde")
                .withThumbprint("aofmxagkvtme")
                .withValidFrom(OffsetDateTime.parse("2020-12-28T20:08:12Z"))
                .withValidTo(OffsetDateTime.parse("2021-06-04T11:35:51Z"))
                .withAadAuthority("zwfqkqujidsuyon")
                .withAadTenantId("bglaocqxtccm")
                .withServicePrincipalClientId("yudxytlmoy")
                .withServicePrincipalObjectId("xv")
                .withAzureManagementEndpointAudience("fudwpznt")
                .withServiceResourceId("dzhlrq")
                .withAadAudience("hckfrlhrx");
        model = BinaryData.fromObject(model).toObject(ResourceCertificateAndAadDetails.class);
        Assertions.assertEquals("yvpycanuzbpzk", model.friendlyName());
        Assertions.assertEquals("kuwbcrnwb", model.issuer());
        Assertions.assertEquals(6623927452976835179L, model.resourceId());
        Assertions.assertEquals("eyvjusrtslhspkde", model.subject());
        Assertions.assertEquals("aofmxagkvtme", model.thumbprint());
        Assertions.assertEquals(OffsetDateTime.parse("2020-12-28T20:08:12Z"), model.validFrom());
        Assertions.assertEquals(OffsetDateTime.parse("2021-06-04T11:35:51Z"), model.validTo());
        Assertions.assertEquals("zwfqkqujidsuyon", model.aadAuthority());
        Assertions.assertEquals("bglaocqxtccm", model.aadTenantId());
        Assertions.assertEquals("yudxytlmoy", model.servicePrincipalClientId());
        Assertions.assertEquals("xv", model.servicePrincipalObjectId());
        Assertions.assertEquals("fudwpznt", model.azureManagementEndpointAudience());
        Assertions.assertEquals("dzhlrq", model.serviceResourceId());
        Assertions.assertEquals("hckfrlhrx", model.aadAudience());
    }
}
