// 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.Baseline;
import com.azure.resourcemanager.security.models.BaselineAdjustedResult;
import com.azure.resourcemanager.security.models.RuleStatus;
import java.time.OffsetDateTime;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class BaselineAdjustedResultTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        BaselineAdjustedResult model =
            BinaryData
                .fromString(
                    "{\"baseline\":{\"expectedResults\":[[\"mfzsbf\"],[\"rzx\",\"dew\",\"rsxkr\",\"lbjazejww\"]],\"updatedTime\":\"2021-03-06T21:39:52Z\"},\"status\":\"Finding\",\"resultsNotInBaseline\":[[\"hbrnnhjx\",\"qwjhqkbiwetpozyc\",\"qiqyhgfsetzlexbs\"],[\"e\",\"ynojpziuw\",\"bzkkd\"]],\"resultsOnlyInBaseline\":[[\"sycljsel\",\"kpbafvafhl\"],[\"lc\"],[\"evxrhyz\",\"fwrsofpltdbmair\",\"hvhfnracw\"]]}")
                .toObject(BaselineAdjustedResult.class);
        Assertions.assertEquals("mfzsbf", model.baseline().expectedResults().get(0).get(0));
        Assertions.assertEquals(OffsetDateTime.parse("2021-03-06T21:39:52Z"), model.baseline().updatedTime());
        Assertions.assertEquals(RuleStatus.FINDING, model.status());
        Assertions.assertEquals("hbrnnhjx", model.resultsNotInBaseline().get(0).get(0));
        Assertions.assertEquals("sycljsel", model.resultsOnlyInBaseline().get(0).get(0));
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        BaselineAdjustedResult model =
            new BaselineAdjustedResult()
                .withBaseline(
                    new Baseline()
                        .withExpectedResults(
                            Arrays.asList(Arrays.asList("mfzsbf"), Arrays.asList("rzx", "dew", "rsxkr", "lbjazejww")))
                        .withUpdatedTime(OffsetDateTime.parse("2021-03-06T21:39:52Z")))
                .withStatus(RuleStatus.FINDING)
                .withResultsNotInBaseline(
                    Arrays
                        .asList(
                            Arrays.asList("hbrnnhjx", "qwjhqkbiwetpozyc", "qiqyhgfsetzlexbs"),
                            Arrays.asList("e", "ynojpziuw", "bzkkd")))
                .withResultsOnlyInBaseline(
                    Arrays
                        .asList(
                            Arrays.asList("sycljsel", "kpbafvafhl"),
                            Arrays.asList("lc"),
                            Arrays.asList("evxrhyz", "fwrsofpltdbmair", "hvhfnracw")));
        model = BinaryData.fromObject(model).toObject(BaselineAdjustedResult.class);
        Assertions.assertEquals("mfzsbf", model.baseline().expectedResults().get(0).get(0));
        Assertions.assertEquals(OffsetDateTime.parse("2021-03-06T21:39:52Z"), model.baseline().updatedTime());
        Assertions.assertEquals(RuleStatus.FINDING, model.status());
        Assertions.assertEquals("hbrnnhjx", model.resultsNotInBaseline().get(0).get(0));
        Assertions.assertEquals("sycljsel", model.resultsOnlyInBaseline().get(0).get(0));
    }
}
