// 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.ResourceCertificateAndAcsDetails;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;

public final class ResourceCertificateAndAcsDetailsTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ResourceCertificateAndAcsDetails model =
            BinaryData
                .fromString(
                    "{\"authType\":\"AccessControlService\",\"globalAcsNamespace\":\"ahvljuaha\",\"globalAcsHostName\":\"uhcdhm\",\"globalAcsRPRealm\":\"ualaexqpvfadmw\",\"friendlyName\":\"r\",\"issuer\":\"xpvgo\",\"resourceId\":1626678916991140455,\"subject\":\"isgwbnbbeldawkz\",\"thumbprint\":\"liourqhak\",\"validFrom\":\"2021-10-01T09:32:58Z\",\"validTo\":\"2021-03-28T02:13:16Z\"}")
                .toObject(ResourceCertificateAndAcsDetails.class);
        Assertions.assertEquals("r", model.friendlyName());
        Assertions.assertEquals("xpvgo", model.issuer());
        Assertions.assertEquals(1626678916991140455L, model.resourceId());
        Assertions.assertEquals("isgwbnbbeldawkz", model.subject());
        Assertions.assertEquals("liourqhak", model.thumbprint());
        Assertions.assertEquals(OffsetDateTime.parse("2021-10-01T09:32:58Z"), model.validFrom());
        Assertions.assertEquals(OffsetDateTime.parse("2021-03-28T02:13:16Z"), model.validTo());
        Assertions.assertEquals("ahvljuaha", model.globalAcsNamespace());
        Assertions.assertEquals("uhcdhm", model.globalAcsHostname());
        Assertions.assertEquals("ualaexqpvfadmw", model.globalAcsRPRealm());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ResourceCertificateAndAcsDetails model =
            new ResourceCertificateAndAcsDetails()
                .withFriendlyName("r")
                .withIssuer("xpvgo")
                .withResourceId(1626678916991140455L)
                .withSubject("isgwbnbbeldawkz")
                .withThumbprint("liourqhak")
                .withValidFrom(OffsetDateTime.parse("2021-10-01T09:32:58Z"))
                .withValidTo(OffsetDateTime.parse("2021-03-28T02:13:16Z"))
                .withGlobalAcsNamespace("ahvljuaha")
                .withGlobalAcsHostname("uhcdhm")
                .withGlobalAcsRPRealm("ualaexqpvfadmw");
        model = BinaryData.fromObject(model).toObject(ResourceCertificateAndAcsDetails.class);
        Assertions.assertEquals("r", model.friendlyName());
        Assertions.assertEquals("xpvgo", model.issuer());
        Assertions.assertEquals(1626678916991140455L, model.resourceId());
        Assertions.assertEquals("isgwbnbbeldawkz", model.subject());
        Assertions.assertEquals("liourqhak", model.thumbprint());
        Assertions.assertEquals(OffsetDateTime.parse("2021-10-01T09:32:58Z"), model.validFrom());
        Assertions.assertEquals(OffsetDateTime.parse("2021-03-28T02:13:16Z"), model.validTo());
        Assertions.assertEquals("ahvljuaha", model.globalAcsNamespace());
        Assertions.assertEquals("uhcdhm", model.globalAcsHostname());
        Assertions.assertEquals("ualaexqpvfadmw", model.globalAcsRPRealm());
    }
}
