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

package com.azure.resourcemanager.advisor.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.advisor.models.Category;
import com.azure.resourcemanager.advisor.models.DigestConfig;
import com.azure.resourcemanager.advisor.models.DigestConfigState;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class DigestConfigTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        DigestConfig model =
            BinaryData
                .fromString(
                    "{\"name\":\"vwryoqpso\",\"actionGroupResourceId\":\"ctazakljlahbcryf\",\"frequency\":1389039399,\"categories\":[\"Performance\",\"Performance\"],\"language\":\"expa\",\"state\":\"Disabled\"}")
                .toObject(DigestConfig.class);
        Assertions.assertEquals("vwryoqpso", model.name());
        Assertions.assertEquals("ctazakljlahbcryf", model.actionGroupResourceId());
        Assertions.assertEquals(1389039399, model.frequency());
        Assertions.assertEquals(Category.PERFORMANCE, model.categories().get(0));
        Assertions.assertEquals("expa", model.language());
        Assertions.assertEquals(DigestConfigState.DISABLED, model.state());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        DigestConfig model =
            new DigestConfig()
                .withName("vwryoqpso")
                .withActionGroupResourceId("ctazakljlahbcryf")
                .withFrequency(1389039399)
                .withCategories(Arrays.asList(Category.PERFORMANCE, Category.PERFORMANCE))
                .withLanguage("expa")
                .withState(DigestConfigState.DISABLED);
        model = BinaryData.fromObject(model).toObject(DigestConfig.class);
        Assertions.assertEquals("vwryoqpso", model.name());
        Assertions.assertEquals("ctazakljlahbcryf", model.actionGroupResourceId());
        Assertions.assertEquals(1389039399, model.frequency());
        Assertions.assertEquals(Category.PERFORMANCE, model.categories().get(0));
        Assertions.assertEquals("expa", model.language());
        Assertions.assertEquals(DigestConfigState.DISABLED, model.state());
    }
}
