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

package com.azure.resourcemanager.netapp.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.netapp.fluent.models.SubvolumeModelInner;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;

public final class SubvolumeModelInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        SubvolumeModelInner model =
            BinaryData
                .fromString(
                    "{\"id\":\"nhlmctlpdng\",\"name\":\"vgbmhr\",\"type\":\"kw\",\"properties\":{\"path\":\"jejveg\",\"parentPath\":\"bpnaixexccbdre\",\"size\":1689934225834062034,\"bytesUsed\":6384745428742694530,\"permissions\":\"rvqahqkghtpwi\",\"creationTimeStamp\":\"2021-03-19T04:26:57Z\",\"accessedTimeStamp\":\"2021-06-17T07:39:44Z\",\"modifiedTimeStamp\":\"2021-05-11T09:36:14Z\",\"changedTimeStamp\":\"2021-09-16T08:46:35Z\",\"provisioningState\":\"xzb\"}}")
                .toObject(SubvolumeModelInner.class);
        Assertions.assertEquals("jejveg", model.path());
        Assertions.assertEquals("bpnaixexccbdre", model.parentPath());
        Assertions.assertEquals(1689934225834062034L, model.size());
        Assertions.assertEquals(6384745428742694530L, model.bytesUsed());
        Assertions.assertEquals("rvqahqkghtpwi", model.permissions());
        Assertions.assertEquals(OffsetDateTime.parse("2021-03-19T04:26:57Z"), model.creationTimestamp());
        Assertions.assertEquals(OffsetDateTime.parse("2021-06-17T07:39:44Z"), model.accessedTimestamp());
        Assertions.assertEquals(OffsetDateTime.parse("2021-05-11T09:36:14Z"), model.modifiedTimestamp());
        Assertions.assertEquals(OffsetDateTime.parse("2021-09-16T08:46:35Z"), model.changedTimestamp());
        Assertions.assertEquals("xzb", model.provisioningState());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        SubvolumeModelInner model =
            new SubvolumeModelInner()
                .withPath("jejveg")
                .withParentPath("bpnaixexccbdre")
                .withSize(1689934225834062034L)
                .withBytesUsed(6384745428742694530L)
                .withPermissions("rvqahqkghtpwi")
                .withCreationTimestamp(OffsetDateTime.parse("2021-03-19T04:26:57Z"))
                .withAccessedTimestamp(OffsetDateTime.parse("2021-06-17T07:39:44Z"))
                .withModifiedTimestamp(OffsetDateTime.parse("2021-05-11T09:36:14Z"))
                .withChangedTimestamp(OffsetDateTime.parse("2021-09-16T08:46:35Z"))
                .withProvisioningState("xzb");
        model = BinaryData.fromObject(model).toObject(SubvolumeModelInner.class);
        Assertions.assertEquals("jejveg", model.path());
        Assertions.assertEquals("bpnaixexccbdre", model.parentPath());
        Assertions.assertEquals(1689934225834062034L, model.size());
        Assertions.assertEquals(6384745428742694530L, model.bytesUsed());
        Assertions.assertEquals("rvqahqkghtpwi", model.permissions());
        Assertions.assertEquals(OffsetDateTime.parse("2021-03-19T04:26:57Z"), model.creationTimestamp());
        Assertions.assertEquals(OffsetDateTime.parse("2021-06-17T07:39:44Z"), model.accessedTimestamp());
        Assertions.assertEquals(OffsetDateTime.parse("2021-05-11T09:36:14Z"), model.modifiedTimestamp());
        Assertions.assertEquals(OffsetDateTime.parse("2021-09-16T08:46:35Z"), model.changedTimestamp());
        Assertions.assertEquals("xzb", model.provisioningState());
    }
}
