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

package com.azure.resourcemanager.reservations.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.reservations.models.QuotaRequestState;
import com.azure.resourcemanager.reservations.models.ResourceName;
import com.azure.resourcemanager.reservations.models.SubRequest;
import org.junit.jupiter.api.Assertions;

public final class SubRequestTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        SubRequest model =
            BinaryData
                .fromString(
                    "{\"limit\":1110186498,\"name\":{\"value\":\"kjj\",\"localizedValue\":\"xrbuukzclew\"},\"resourceType\":\"mlwpazt\",\"unit\":\"ofncckwyfzqwhxxb\",\"provisioningState\":\"Failed\",\"message\":\"xzfe\",\"subRequestId\":\"tpp\"}")
                .toObject(SubRequest.class);
        Assertions.assertEquals("kjj", model.name().value());
        Assertions.assertEquals("ofncckwyfzqwhxxb", model.unit());
        Assertions.assertEquals(QuotaRequestState.FAILED, model.provisioningState());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        SubRequest model =
            new SubRequest()
                .withName(new ResourceName().withValue("kjj"))
                .withUnit("ofncckwyfzqwhxxb")
                .withProvisioningState(QuotaRequestState.FAILED);
        model = BinaryData.fromObject(model).toObject(SubRequest.class);
        Assertions.assertEquals("kjj", model.name().value());
        Assertions.assertEquals("ofncckwyfzqwhxxb", model.unit());
        Assertions.assertEquals(QuotaRequestState.FAILED, model.provisioningState());
    }
}
