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

package com.azure.resourcemanager.nginx.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.nginx.models.NginxConfigurationFile;
import com.azure.resourcemanager.nginx.models.NginxConfigurationPackage;
import com.azure.resourcemanager.nginx.models.NginxConfigurationProperties;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class NginxConfigurationPropertiesTests {
    @Test
    public void testDeserialize() {
        NginxConfigurationProperties model =
            BinaryData
                .fromString(
                    "{\"provisioningState\":\"Updating\",\"files\":[{\"content\":\"dvhpfxxypininm\",\"virtualPath\":\"huyb\"},{\"content\":\"podepoo\",\"virtualPath\":\"nuvamiheogna\"},{\"content\":\"zxtheotusivyevcc\",\"virtualPath\":\"ihnhun\"}],\"protectedFiles\":[{\"content\":\"zrnf\",\"virtualPath\":\"xgispemvtzfkufu\"},{\"content\":\"jofxqe\",\"virtualPath\":\"jaeq\"},{\"content\":\"qjbasvms\",\"virtualPath\":\"qulngsntnbybkzgc\"},{\"content\":\"wclxxwrl\",\"virtualPath\":\"ouskcqvkocrc\"}],\"package\":{\"data\":\"wtnhxbnjbiksqr\"},\"rootFile\":\"ssainqpjwnzll\"}")
                .toObject(NginxConfigurationProperties.class);
        Assertions.assertEquals("dvhpfxxypininm", model.files().get(0).content());
        Assertions.assertEquals("huyb", model.files().get(0).virtualPath());
        Assertions.assertEquals("zrnf", model.protectedFiles().get(0).content());
        Assertions.assertEquals("xgispemvtzfkufu", model.protectedFiles().get(0).virtualPath());
        Assertions.assertEquals("wtnhxbnjbiksqr", model.packageProperty().data());
        Assertions.assertEquals("ssainqpjwnzll", model.rootFile());
    }

    @Test
    public void testSerialize() {
        NginxConfigurationProperties model =
            new NginxConfigurationProperties()
                .withFiles(
                    Arrays
                        .asList(
                            new NginxConfigurationFile().withContent("dvhpfxxypininm").withVirtualPath("huyb"),
                            new NginxConfigurationFile().withContent("podepoo").withVirtualPath("nuvamiheogna"),
                            new NginxConfigurationFile().withContent("zxtheotusivyevcc").withVirtualPath("ihnhun")))
                .withProtectedFiles(
                    Arrays
                        .asList(
                            new NginxConfigurationFile().withContent("zrnf").withVirtualPath("xgispemvtzfkufu"),
                            new NginxConfigurationFile().withContent("jofxqe").withVirtualPath("jaeq"),
                            new NginxConfigurationFile().withContent("qjbasvms").withVirtualPath("qulngsntnbybkzgc"),
                            new NginxConfigurationFile().withContent("wclxxwrl").withVirtualPath("ouskcqvkocrc")))
                .withPackageProperty(new NginxConfigurationPackage().withData("wtnhxbnjbiksqr"))
                .withRootFile("ssainqpjwnzll");
        model = BinaryData.fromObject(model).toObject(NginxConfigurationProperties.class);
        Assertions.assertEquals("dvhpfxxypininm", model.files().get(0).content());
        Assertions.assertEquals("huyb", model.files().get(0).virtualPath());
        Assertions.assertEquals("zrnf", model.protectedFiles().get(0).content());
        Assertions.assertEquals("xgispemvtzfkufu", model.protectedFiles().get(0).virtualPath());
        Assertions.assertEquals("wtnhxbnjbiksqr", model.packageProperty().data());
        Assertions.assertEquals("ssainqpjwnzll", model.rootFile());
    }
}
