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

package com.azure.resourcemanager.signalr.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.signalr.models.LiveTraceCategory;
import com.azure.resourcemanager.signalr.models.LiveTraceConfiguration;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class LiveTraceConfigurationTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        LiveTraceConfiguration model =
            BinaryData
                .fromString(
                    "{\"enabled\":\"wgxhn\",\"categories\":[{\"name\":\"fbkp\",\"enabled\":\"gklwn\"},{\"name\":\"hjdauwhvylwz\",\"enabled\":\"dhxujznbmpo\"},{\"name\":\"wpr\",\"enabled\":\"lve\"},{\"name\":\"lupj\",\"enabled\":\"hfxobbcswsrtj\"}]}")
                .toObject(LiveTraceConfiguration.class);
        Assertions.assertEquals("wgxhn", model.enabled());
        Assertions.assertEquals("fbkp", model.categories().get(0).name());
        Assertions.assertEquals("gklwn", model.categories().get(0).enabled());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        LiveTraceConfiguration model =
            new LiveTraceConfiguration()
                .withEnabled("wgxhn")
                .withCategories(
                    Arrays
                        .asList(
                            new LiveTraceCategory().withName("fbkp").withEnabled("gklwn"),
                            new LiveTraceCategory().withName("hjdauwhvylwz").withEnabled("dhxujznbmpo"),
                            new LiveTraceCategory().withName("wpr").withEnabled("lve"),
                            new LiveTraceCategory().withName("lupj").withEnabled("hfxobbcswsrtj")));
        model = BinaryData.fromObject(model).toObject(LiveTraceConfiguration.class);
        Assertions.assertEquals("wgxhn", model.enabled());
        Assertions.assertEquals("fbkp", model.categories().get(0).name());
        Assertions.assertEquals("gklwn", model.categories().get(0).enabled());
    }
}
