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

package com.azure.resourcemanager.security.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.security.models.BenchmarkReference;
import com.azure.resourcemanager.security.models.QueryCheck;
import com.azure.resourcemanager.security.models.RuleSeverity;
import com.azure.resourcemanager.security.models.RuleType;
import com.azure.resourcemanager.security.models.VaRule;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class VaRuleTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        VaRule model =
            BinaryData
                .fromString(
                    "{\"ruleId\":\"knaqlnuwig\",\"severity\":\"Low\",\"category\":\"ykwphvxzcwxhmpe\",\"ruleType\":\"NegativeList\",\"title\":\"exaonwivkcq\",\"description\":\"xhxknlc\",\"rationale\":\"mmkyu\",\"queryCheck\":{\"query\":\"ubyqj\",\"expectedResult\":[[\"fqfrkemyildudxja\"],[\"owvfdjkpdxph\",\"kk\",\"nmgzvyfijdkzuqnw\"],[\"thuqolyahluq\"],[\"ulsutrjbhxy\",\"fhyqezvqqugdrft\",\"cvexreuqu\",\"wtl\"]],\"columnNames\":[\"whreagkhyxvrq\",\"vbczsulmdg\",\"lmepjpf\"]},\"benchmarkReferences\":[{\"benchmark\":\"g\",\"reference\":\"ngpszngafpg\"},{\"benchmark\":\"kvec\",\"reference\":\"jcngoadyed\"},{\"benchmark\":\"rgjfoknubnoi\",\"reference\":\"kpztrgd\"}]}")
                .toObject(VaRule.class);
        Assertions.assertEquals("knaqlnuwig", model.ruleId());
        Assertions.assertEquals(RuleSeverity.LOW, model.severity());
        Assertions.assertEquals("ykwphvxzcwxhmpe", model.category());
        Assertions.assertEquals(RuleType.NEGATIVE_LIST, model.ruleType());
        Assertions.assertEquals("exaonwivkcq", model.title());
        Assertions.assertEquals("xhxknlc", model.description());
        Assertions.assertEquals("mmkyu", model.rationale());
        Assertions.assertEquals("ubyqj", model.queryCheck().query());
        Assertions.assertEquals("fqfrkemyildudxja", model.queryCheck().expectedResult().get(0).get(0));
        Assertions.assertEquals("whreagkhyxvrq", model.queryCheck().columnNames().get(0));
        Assertions.assertEquals("g", model.benchmarkReferences().get(0).benchmark());
        Assertions.assertEquals("ngpszngafpg", model.benchmarkReferences().get(0).reference());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        VaRule model =
            new VaRule()
                .withRuleId("knaqlnuwig")
                .withSeverity(RuleSeverity.LOW)
                .withCategory("ykwphvxzcwxhmpe")
                .withRuleType(RuleType.NEGATIVE_LIST)
                .withTitle("exaonwivkcq")
                .withDescription("xhxknlc")
                .withRationale("mmkyu")
                .withQueryCheck(
                    new QueryCheck()
                        .withQuery("ubyqj")
                        .withExpectedResult(
                            Arrays
                                .asList(
                                    Arrays.asList("fqfrkemyildudxja"),
                                    Arrays.asList("owvfdjkpdxph", "kk", "nmgzvyfijdkzuqnw"),
                                    Arrays.asList("thuqolyahluq"),
                                    Arrays.asList("ulsutrjbhxy", "fhyqezvqqugdrft", "cvexreuqu", "wtl")))
                        .withColumnNames(Arrays.asList("whreagkhyxvrq", "vbczsulmdg", "lmepjpf")))
                .withBenchmarkReferences(
                    Arrays
                        .asList(
                            new BenchmarkReference().withBenchmark("g").withReference("ngpszngafpg"),
                            new BenchmarkReference().withBenchmark("kvec").withReference("jcngoadyed"),
                            new BenchmarkReference().withBenchmark("rgjfoknubnoi").withReference("kpztrgd")));
        model = BinaryData.fromObject(model).toObject(VaRule.class);
        Assertions.assertEquals("knaqlnuwig", model.ruleId());
        Assertions.assertEquals(RuleSeverity.LOW, model.severity());
        Assertions.assertEquals("ykwphvxzcwxhmpe", model.category());
        Assertions.assertEquals(RuleType.NEGATIVE_LIST, model.ruleType());
        Assertions.assertEquals("exaonwivkcq", model.title());
        Assertions.assertEquals("xhxknlc", model.description());
        Assertions.assertEquals("mmkyu", model.rationale());
        Assertions.assertEquals("ubyqj", model.queryCheck().query());
        Assertions.assertEquals("fqfrkemyildudxja", model.queryCheck().expectedResult().get(0).get(0));
        Assertions.assertEquals("whreagkhyxvrq", model.queryCheck().columnNames().get(0));
        Assertions.assertEquals("g", model.benchmarkReferences().get(0).benchmark());
        Assertions.assertEquals("ngpszngafpg", model.benchmarkReferences().get(0).reference());
    }
}
