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

package com.azure.resourcemanager.elasticsan.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.elasticsan.fluent.models.VolumeProperties;
import com.azure.resourcemanager.elasticsan.models.SourceCreationData;
import com.azure.resourcemanager.elasticsan.models.VolumeCreateOption;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class VolumePropertiesTests {
    @Test
    public void testDeserialize() {
        VolumeProperties model =
            BinaryData
                .fromString(
                    "{\"volumeId\":\"pmng\",\"creationData\":{\"createSource\":\"None\",\"sourceUri\":\"aqw\"},\"sizeGiB\":8694303623294898689,\"storageTarget\":{\"targetIqn\":\"onq\",\"targetPortalHostname\":\"kvlrxnj\",\"targetPortalPort\":1486121572,\"provisioningState\":\"Deleting\",\"status\":\"Stopped"
                        + " (deallocated)\"}}")
                .toObject(VolumeProperties.class);
        Assertions.assertEquals(VolumeCreateOption.NONE, model.creationData().createSource());
        Assertions.assertEquals("aqw", model.creationData().sourceUri());
        Assertions.assertEquals(8694303623294898689L, model.sizeGiB());
    }

    @Test
    public void testSerialize() {
        VolumeProperties model =
            new VolumeProperties()
                .withCreationData(
                    new SourceCreationData().withCreateSource(VolumeCreateOption.NONE).withSourceUri("aqw"))
                .withSizeGiB(8694303623294898689L);
        model = BinaryData.fromObject(model).toObject(VolumeProperties.class);
        Assertions.assertEquals(VolumeCreateOption.NONE, model.creationData().createSource());
        Assertions.assertEquals("aqw", model.creationData().sourceUri());
        Assertions.assertEquals(8694303623294898689L, model.sizeGiB());
    }
}
