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

package com.azure.resourcemanager.mariadb.generated;

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

public final class WaitStatisticPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        WaitStatisticProperties model =
            BinaryData
                .fromString(
                    "{\"startTime\":\"2021-08-04T10:24:08Z\",\"endTime\":\"2021-07-05T08:36:14Z\",\"eventName\":\"pz\",\"eventTypeName\":\"xhdzhlrqjbhckf\",\"queryId\":6543879944519090498,\"databaseName\":\"sbkyvpycanuzbp\",\"userId\":6075974132031509292,\"count\":3708510664132188472,\"totalTimeInMs\":47.77122021127458}")
                .toObject(WaitStatisticProperties.class);
        Assertions.assertEquals(OffsetDateTime.parse("2021-08-04T10:24:08Z"), model.startTime());
        Assertions.assertEquals(OffsetDateTime.parse("2021-07-05T08:36:14Z"), model.endTime());
        Assertions.assertEquals("pz", model.eventName());
        Assertions.assertEquals("xhdzhlrqjbhckf", model.eventTypeName());
        Assertions.assertEquals(6543879944519090498L, model.queryId());
        Assertions.assertEquals("sbkyvpycanuzbp", model.databaseName());
        Assertions.assertEquals(6075974132031509292L, model.userId());
        Assertions.assertEquals(3708510664132188472L, model.count());
        Assertions.assertEquals(47.77122021127458D, model.totalTimeInMs());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        WaitStatisticProperties model =
            new WaitStatisticProperties()
                .withStartTime(OffsetDateTime.parse("2021-08-04T10:24:08Z"))
                .withEndTime(OffsetDateTime.parse("2021-07-05T08:36:14Z"))
                .withEventName("pz")
                .withEventTypeName("xhdzhlrqjbhckf")
                .withQueryId(6543879944519090498L)
                .withDatabaseName("sbkyvpycanuzbp")
                .withUserId(6075974132031509292L)
                .withCount(3708510664132188472L)
                .withTotalTimeInMs(47.77122021127458D);
        model = BinaryData.fromObject(model).toObject(WaitStatisticProperties.class);
        Assertions.assertEquals(OffsetDateTime.parse("2021-08-04T10:24:08Z"), model.startTime());
        Assertions.assertEquals(OffsetDateTime.parse("2021-07-05T08:36:14Z"), model.endTime());
        Assertions.assertEquals("pz", model.eventName());
        Assertions.assertEquals("xhdzhlrqjbhckf", model.eventTypeName());
        Assertions.assertEquals(6543879944519090498L, model.queryId());
        Assertions.assertEquals("sbkyvpycanuzbp", model.databaseName());
        Assertions.assertEquals(6075974132031509292L, model.userId());
        Assertions.assertEquals(3708510664132188472L, model.count());
        Assertions.assertEquals(47.77122021127458D, model.totalTimeInMs());
    }
}
