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

package com.azure.resourcemanager.storagepool.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.storagepool.fluent.models.StoragePoolRPOperationInner;
import com.azure.resourcemanager.storagepool.models.StoragePoolOperationDisplay;
import org.junit.jupiter.api.Assertions;

public final class StoragePoolRPOperationInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        StoragePoolRPOperationInner model =
            BinaryData
                .fromString(
                    "{\"name\":\"eitjz\",\"isDataAction\":true,\"actionType\":\"usarhmofc\",\"display\":{\"provider\":\"hs\",\"resource\":\"yurkdtmlxhekuksj\",\"operation\":\"xukcdmpar\",\"description\":\"ryuanzwuxzdxtay\"},\"origin\":\"hmwhfpmrqo\"}")
                .toObject(StoragePoolRPOperationInner.class);
        Assertions.assertEquals("eitjz", model.name());
        Assertions.assertEquals(true, model.isDataAction());
        Assertions.assertEquals("usarhmofc", model.actionType());
        Assertions.assertEquals("hs", model.display().provider());
        Assertions.assertEquals("yurkdtmlxhekuksj", model.display().resource());
        Assertions.assertEquals("xukcdmpar", model.display().operation());
        Assertions.assertEquals("ryuanzwuxzdxtay", model.display().description());
        Assertions.assertEquals("hmwhfpmrqo", model.origin());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        StoragePoolRPOperationInner model =
            new StoragePoolRPOperationInner()
                .withName("eitjz")
                .withIsDataAction(true)
                .withActionType("usarhmofc")
                .withDisplay(
                    new StoragePoolOperationDisplay()
                        .withProvider("hs")
                        .withResource("yurkdtmlxhekuksj")
                        .withOperation("xukcdmpar")
                        .withDescription("ryuanzwuxzdxtay"))
                .withOrigin("hmwhfpmrqo");
        model = BinaryData.fromObject(model).toObject(StoragePoolRPOperationInner.class);
        Assertions.assertEquals("eitjz", model.name());
        Assertions.assertEquals(true, model.isDataAction());
        Assertions.assertEquals("usarhmofc", model.actionType());
        Assertions.assertEquals("hs", model.display().provider());
        Assertions.assertEquals("yurkdtmlxhekuksj", model.display().resource());
        Assertions.assertEquals("xukcdmpar", model.display().operation());
        Assertions.assertEquals("ryuanzwuxzdxtay", model.display().description());
        Assertions.assertEquals("hmwhfpmrqo", model.origin());
    }
}
