// 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.DatastoreInner;
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 DatastoreInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        DatastoreInner model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"provisioningState\":\"Creating\",\"netAppVolume\":{\"id\":\"vjrbirphxepcyvah\"},\"diskPoolVolume\":{\"targetId\":\"ljkyqxjvuuj\",\"lunName\":\"gidokgjljyoxgvcl\",\"mountOption\":\"ATTACH\",\"path\":\"ncghkje\"},\"status\":\"Accessible\"},\"id\":\"hbijhtxfvgxb\",\"name\":\"smx\",\"type\":\"eh\"}")
                .toObject(DatastoreInner.class);
        Assertions.assertEquals("vjrbirphxepcyvah", model.netAppVolume().id());
        Assertions.assertEquals("ljkyqxjvuuj", model.diskPoolVolume().targetId());
        Assertions.assertEquals("gidokgjljyoxgvcl", model.diskPoolVolume().lunName());
        Assertions.assertEquals(MountOptionEnum.ATTACH, model.diskPoolVolume().mountOption());
    }

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