// 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.models.CertificateReference;
import com.azure.resourcemanager.batch.models.CertificateStoreLocation;
import com.azure.resourcemanager.batch.models.CertificateVisibility;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class CertificateReferenceTests {
    @Test
    public void testDeserialize() {
        CertificateReference model =
            BinaryData
                .fromString(
                    "{\"id\":\"vpa\",\"storeLocation\":\"LocalMachine\",\"storeName\":\"qqu\",\"visibility\":[\"RemoteUser\"]}")
                .toObject(CertificateReference.class);
        Assertions.assertEquals("vpa", model.id());
        Assertions.assertEquals(CertificateStoreLocation.LOCAL_MACHINE, model.storeLocation());
        Assertions.assertEquals("qqu", model.storeName());
        Assertions.assertEquals(CertificateVisibility.REMOTE_USER, model.visibility().get(0));
    }

    @Test
    public void testSerialize() {
        CertificateReference model =
            new CertificateReference()
                .withId("vpa")
                .withStoreLocation(CertificateStoreLocation.LOCAL_MACHINE)
                .withStoreName("qqu")
                .withVisibility(Arrays.asList(CertificateVisibility.REMOTE_USER));
        model = BinaryData.fromObject(model).toObject(CertificateReference.class);
        Assertions.assertEquals("vpa", model.id());
        Assertions.assertEquals(CertificateStoreLocation.LOCAL_MACHINE, model.storeLocation());
        Assertions.assertEquals("qqu", model.storeName());
        Assertions.assertEquals(CertificateVisibility.REMOTE_USER, model.visibility().get(0));
    }
}
