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

package com.azure.resourcemanager.peering.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.peering.fluent.models.PeerAsnProperties;
import com.azure.resourcemanager.peering.models.ContactDetail;
import com.azure.resourcemanager.peering.models.Role;
import com.azure.resourcemanager.peering.models.ValidationState;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class PeerAsnPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        PeerAsnProperties model =
            BinaryData
                .fromString(
                    "{\"peerAsn\":1686193188,\"peerContactDetail\":[{\"role\":\"Other\",\"email\":\"hix\",\"phone\":\"gdtopbobjogh\"}],\"peerName\":\"w\",\"validationState\":\"None\",\"errorMessage\":\"uhrzayvvt\"}")
                .toObject(PeerAsnProperties.class);
        Assertions.assertEquals(1686193188, model.peerAsn());
        Assertions.assertEquals(Role.OTHER, model.peerContactDetail().get(0).role());
        Assertions.assertEquals("hix", model.peerContactDetail().get(0).email());
        Assertions.assertEquals("gdtopbobjogh", model.peerContactDetail().get(0).phone());
        Assertions.assertEquals("w", model.peerName());
        Assertions.assertEquals(ValidationState.NONE, model.validationState());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        PeerAsnProperties model =
            new PeerAsnProperties()
                .withPeerAsn(1686193188)
                .withPeerContactDetail(
                    Arrays.asList(new ContactDetail().withRole(Role.OTHER).withEmail("hix").withPhone("gdtopbobjogh")))
                .withPeerName("w")
                .withValidationState(ValidationState.NONE);
        model = BinaryData.fromObject(model).toObject(PeerAsnProperties.class);
        Assertions.assertEquals(1686193188, model.peerAsn());
        Assertions.assertEquals(Role.OTHER, model.peerContactDetail().get(0).role());
        Assertions.assertEquals("hix", model.peerContactDetail().get(0).email());
        Assertions.assertEquals("gdtopbobjogh", model.peerContactDetail().get(0).phone());
        Assertions.assertEquals("w", model.peerName());
        Assertions.assertEquals(ValidationState.NONE, model.validationState());
    }
}
