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

package com.azure.resourcemanager.avs.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.avs.fluent.models.DatastoreProperties;
import com.azure.resourcemanager.avs.models.DiskPoolVolume;
import com.azure.resourcemanager.avs.models.MountOptionEnum;
import com.azure.resourcemanager.avs.models.NetAppVolume;
import org.junit.jupiter.api.Assertions;

public final class DatastorePropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        DatastoreProperties model =
            BinaryData
                .fromString(
                    "{\"provisioningState\":\"Creating\",\"netAppVolume\":{\"id\":\"cgjbirxbp\"},\"diskPoolVolume\":{\"targetId\":\"srfbjfdtwss\",\"lunName\":\"t\",\"mountOption\":\"MOUNT\",\"path\":\"jzbexilzznfq\"},\"status\":\"Inaccessible\"}")
                .toObject(DatastoreProperties.class);
        Assertions.assertEquals("cgjbirxbp", model.netAppVolume().id());
        Assertions.assertEquals("srfbjfdtwss", model.diskPoolVolume().targetId());
        Assertions.assertEquals("t", model.diskPoolVolume().lunName());
        Assertions.assertEquals(MountOptionEnum.MOUNT, model.diskPoolVolume().mountOption());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        DatastoreProperties model =
            new DatastoreProperties()
                .withNetAppVolume(new NetAppVolume().withId("cgjbirxbp"))
                .withDiskPoolVolume(
                    new DiskPoolVolume()
                        .withTargetId("srfbjfdtwss")
                        .withLunName("t")
                        .withMountOption(MountOptionEnum.MOUNT));
        model = BinaryData.fromObject(model).toObject(DatastoreProperties.class);
        Assertions.assertEquals("cgjbirxbp", model.netAppVolume().id());
        Assertions.assertEquals("srfbjfdtwss", model.diskPoolVolume().targetId());
        Assertions.assertEquals("t", model.diskPoolVolume().lunName());
        Assertions.assertEquals(MountOptionEnum.MOUNT, model.diskPoolVolume().mountOption());
    }
}
