// 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.LogFileInner;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;

public final class LogFileInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        LogFileInner model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"sizeInKB\":4120497332139202867,\"createdTime\":\"2021-11-07T06:02Z\",\"type\":\"ynnaam\",\"lastModifiedTime\":\"2021-01-19T03:02:26Z\",\"url\":\"eh\"},\"id\":\"qsc\",\"name\":\"eypvhezrkg\",\"type\":\"hcjrefovgmk\"}")
                .toObject(LogFileInner.class);
        Assertions.assertEquals(4120497332139202867L, model.sizeInKB());
        Assertions.assertEquals(OffsetDateTime.parse("2021-11-07T06:02Z"), model.createdTime());
        Assertions.assertEquals("ynnaam", model.typePropertiesType());
        Assertions.assertEquals(OffsetDateTime.parse("2021-01-19T03:02:26Z"), model.lastModifiedTime());
        Assertions.assertEquals("eh", model.url());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        LogFileInner model =
            new LogFileInner()
                .withSizeInKB(4120497332139202867L)
                .withCreatedTime(OffsetDateTime.parse("2021-11-07T06:02Z"))
                .withTypePropertiesType("ynnaam")
                .withLastModifiedTime(OffsetDateTime.parse("2021-01-19T03:02:26Z"))
                .withUrl("eh");
        model = BinaryData.fromObject(model).toObject(LogFileInner.class);
        Assertions.assertEquals(4120497332139202867L, model.sizeInKB());
        Assertions.assertEquals(OffsetDateTime.parse("2021-11-07T06:02Z"), model.createdTime());
        Assertions.assertEquals("ynnaam", model.typePropertiesType());
        Assertions.assertEquals(OffsetDateTime.parse("2021-01-19T03:02:26Z"), model.lastModifiedTime());
        Assertions.assertEquals("eh", model.url());
    }
}
