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

package com.azure.resourcemanager.logic.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.logic.models.ApiReference;
import com.azure.resourcemanager.logic.models.ApiTier;
import com.azure.resourcemanager.logic.models.ResourceReference;
import org.junit.jupiter.api.Assertions;

public final class ApiReferenceTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ApiReference model =
            BinaryData
                .fromString(
                    "{\"displayName\":\"jnhgwydyyn\",\"description\":\"vkh\",\"iconUri\":\"vqtanarfdlpuk\",\"swagger\":\"datayrneizjcpeo\",\"brandColor\":\"hnmgbroux\",\"category\":\"Premium\",\"integrationServiceEnvironment\":{\"id\":\"hpfpazjzoywjxhp\",\"name\":\"lontacnpq\",\"type\":\"ehtuevrhr\"},\"id\":\"yoogw\",\"name\":\"nsduugwbsre\",\"type\":\"fqkfuarenl\"}")
                .toObject(ApiReference.class);
        Assertions.assertEquals("yoogw", model.id());
        Assertions.assertEquals("jnhgwydyyn", model.displayName());
        Assertions.assertEquals("vkh", model.description());
        Assertions.assertEquals("vqtanarfdlpuk", model.iconUri());
        Assertions.assertEquals("hnmgbroux", model.brandColor());
        Assertions.assertEquals(ApiTier.PREMIUM, model.category());
        Assertions.assertEquals("hpfpazjzoywjxhp", model.integrationServiceEnvironment().id());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ApiReference model =
            new ApiReference()
                .withId("yoogw")
                .withDisplayName("jnhgwydyyn")
                .withDescription("vkh")
                .withIconUri("vqtanarfdlpuk")
                .withSwagger("datayrneizjcpeo")
                .withBrandColor("hnmgbroux")
                .withCategory(ApiTier.PREMIUM)
                .withIntegrationServiceEnvironment(new ResourceReference().withId("hpfpazjzoywjxhp"));
        model = BinaryData.fromObject(model).toObject(ApiReference.class);
        Assertions.assertEquals("yoogw", model.id());
        Assertions.assertEquals("jnhgwydyyn", model.displayName());
        Assertions.assertEquals("vkh", model.description());
        Assertions.assertEquals("vqtanarfdlpuk", model.iconUri());
        Assertions.assertEquals("hnmgbroux", model.brandColor());
        Assertions.assertEquals(ApiTier.PREMIUM, model.category());
        Assertions.assertEquals("hpfpazjzoywjxhp", model.integrationServiceEnvironment().id());
    }
}
