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

package com.azure.resourcemanager.iothub.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.iothub.fluent.models.CertificateDescriptionInner;
import com.azure.resourcemanager.iothub.fluent.models.CertificateListDescriptionInner;
import com.azure.resourcemanager.iothub.models.CertificateProperties;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class CertificateListDescriptionInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        CertificateListDescriptionInner model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"subject\":\"uoegrpkhjwniyqs\",\"expiry\":\"Mon, 01 Mar 2021"
                        + " 06:19:30 GMT\",\"thumbprint\":\"pdggkzzlvm\",\"isVerified\":true,\"created\":\"Fri, 04 Jun"
                        + " 2021 21:38:56 GMT\",\"updated\":\"Wed, 28 Apr 2021 10:55:20"
                        + " GMT\",\"certificate\":\"fv\"},\"etag\":\"fy\",\"id\":\"sbpfvmwyhr\",\"name\":\"ouyftaakc\",\"type\":\"wiyzvqtmnubexkp\"}]}")
                .toObject(CertificateListDescriptionInner.class);
        Assertions.assertEquals(true, model.value().get(0).properties().isVerified());
        Assertions.assertEquals("fv", model.value().get(0).properties().certificate());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        CertificateListDescriptionInner model =
            new CertificateListDescriptionInner()
                .withValue(
                    Arrays
                        .asList(
                            new CertificateDescriptionInner()
                                .withProperties(
                                    new CertificateProperties().withIsVerified(true).withCertificate("fv"))));
        model = BinaryData.fromObject(model).toObject(CertificateListDescriptionInner.class);
        Assertions.assertEquals(true, model.value().get(0).properties().isVerified());
        Assertions.assertEquals("fv", model.value().get(0).properties().certificate());
    }
}
