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

package com.azure.resourcemanager.batch.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.batch.fluent.models.CertificateInner;
import com.azure.resourcemanager.batch.models.CertificateFormat;
import com.azure.resourcemanager.batch.models.ListCertificatesResult;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class ListCertificatesResultTests {
    @Test
    public void testDeserialize() {
        ListCertificatesResult model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"provisioningState\":\"Failed\",\"provisioningStateTransitionTime\":\"2021-11-08T07:16:59Z\",\"previousProvisioningState\":\"Deleting\",\"previousProvisioningStateTransitionTime\":\"2021-05-09T09:45:07Z\",\"publicData\":\"czwtruwiqzbqjv\",\"thumbprintAlgorithm\":\"myokacspkwlh\",\"thumbprint\":\"obpxjmflbvvn\",\"format\":\"Cer\"},\"etag\":\"cciw\",\"id\":\"zjuqkhrsaj\",\"name\":\"wkuofoskghsauu\",\"type\":\"mjmvxieduugidyjr\"}],\"nextLink\":\"byao\"}")
                .toObject(ListCertificatesResult.class);
        Assertions.assertEquals("myokacspkwlh", model.value().get(0).thumbprintAlgorithm());
        Assertions.assertEquals("obpxjmflbvvn", model.value().get(0).thumbprint());
        Assertions.assertEquals(CertificateFormat.CER, model.value().get(0).format());
        Assertions.assertEquals("byao", model.nextLink());
    }

    @Test
    public void testSerialize() {
        ListCertificatesResult model =
            new ListCertificatesResult()
                .withValue(
                    Arrays
                        .asList(
                            new CertificateInner()
                                .withThumbprintAlgorithm("myokacspkwlh")
                                .withThumbprint("obpxjmflbvvn")
                                .withFormat(CertificateFormat.CER)))
                .withNextLink("byao");
        model = BinaryData.fromObject(model).toObject(ListCertificatesResult.class);
        Assertions.assertEquals("myokacspkwlh", model.value().get(0).thumbprintAlgorithm());
        Assertions.assertEquals("obpxjmflbvvn", model.value().get(0).thumbprint());
        Assertions.assertEquals(CertificateFormat.CER, model.value().get(0).format());
        Assertions.assertEquals("byao", model.nextLink());
    }
}
