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

public final class ResourceCertificateDetailsTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ResourceCertificateDetails model =
            BinaryData
                .fromString(
                    "{\"authType\":\"ResourceCertificateDetails\",\"friendlyName\":\"izhwlrxy\",\"issuer\":\"soqijg\",\"resourceId\":7369620870818526832,\"subject\":\"azlobcufpdznrbt\",\"thumbprint\":\"qjnqglhqgnufoooj\",\"validFrom\":\"2021-06-05T07:25:28Z\",\"validTo\":\"2021-11-19T20:38:19Z\"}")
                .toObject(ResourceCertificateDetails.class);
        Assertions.assertEquals("izhwlrxy", model.friendlyName());
        Assertions.assertEquals("soqijg", model.issuer());
        Assertions.assertEquals(7369620870818526832L, model.resourceId());
        Assertions.assertEquals("azlobcufpdznrbt", model.subject());
        Assertions.assertEquals("qjnqglhqgnufoooj", model.thumbprint());
        Assertions.assertEquals(OffsetDateTime.parse("2021-06-05T07:25:28Z"), model.validFrom());
        Assertions.assertEquals(OffsetDateTime.parse("2021-11-19T20:38:19Z"), model.validTo());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ResourceCertificateDetails model =
            new ResourceCertificateDetails()
                .withFriendlyName("izhwlrxy")
                .withIssuer("soqijg")
                .withResourceId(7369620870818526832L)
                .withSubject("azlobcufpdznrbt")
                .withThumbprint("qjnqglhqgnufoooj")
                .withValidFrom(OffsetDateTime.parse("2021-06-05T07:25:28Z"))
                .withValidTo(OffsetDateTime.parse("2021-11-19T20:38:19Z"));
        model = BinaryData.fromObject(model).toObject(ResourceCertificateDetails.class);
        Assertions.assertEquals("izhwlrxy", model.friendlyName());
        Assertions.assertEquals("soqijg", model.issuer());
        Assertions.assertEquals(7369620870818526832L, model.resourceId());
        Assertions.assertEquals("azlobcufpdznrbt", model.subject());
        Assertions.assertEquals("qjnqglhqgnufoooj", model.thumbprint());
        Assertions.assertEquals(OffsetDateTime.parse("2021-06-05T07:25:28Z"), model.validFrom());
        Assertions.assertEquals(OffsetDateTime.parse("2021-11-19T20:38:19Z"), model.validTo());
    }
}
