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

package com.azure.resourcemanager.mysqlflexibleserver.generated;

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

public final class LogFilePropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        LogFileProperties model =
            BinaryData
                .fromString(
                    "{\"sizeInKB\":6110578012532965907,\"createdTime\":\"2021-08-20T18:32:02Z\",\"type\":\"xyqj\",\"lastModifiedTime\":\"2021-03-22T06:48:14Z\",\"url\":\"t\"}")
                .toObject(LogFileProperties.class);
        Assertions.assertEquals(6110578012532965907L, model.sizeInKB());
        Assertions.assertEquals(OffsetDateTime.parse("2021-08-20T18:32:02Z"), model.createdTime());
        Assertions.assertEquals("xyqj", model.type());
        Assertions.assertEquals(OffsetDateTime.parse("2021-03-22T06:48:14Z"), model.lastModifiedTime());
        Assertions.assertEquals("t", model.url());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        LogFileProperties model =
            new LogFileProperties()
                .withSizeInKB(6110578012532965907L)
                .withCreatedTime(OffsetDateTime.parse("2021-08-20T18:32:02Z"))
                .withType("xyqj")
                .withLastModifiedTime(OffsetDateTime.parse("2021-03-22T06:48:14Z"))
                .withUrl("t");
        model = BinaryData.fromObject(model).toObject(LogFileProperties.class);
        Assertions.assertEquals(6110578012532965907L, model.sizeInKB());
        Assertions.assertEquals(OffsetDateTime.parse("2021-08-20T18:32:02Z"), model.createdTime());
        Assertions.assertEquals("xyqj", model.type());
        Assertions.assertEquals(OffsetDateTime.parse("2021-03-22T06:48:14Z"), model.lastModifiedTime());
        Assertions.assertEquals("t", model.url());
    }
}
