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

package com.azure.resourcemanager.changeanalysis.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.changeanalysis.models.ChangeCategory;
import com.azure.resourcemanager.changeanalysis.models.ChangeType;
import com.azure.resourcemanager.changeanalysis.models.Level;
import com.azure.resourcemanager.changeanalysis.models.PropertyChange;
import org.junit.jupiter.api.Assertions;

public final class PropertyChangeTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        PropertyChange model =
            BinaryData
                .fromString(
                    "{\"changeType\":\"Update\",\"changeCategory\":\"System\",\"jsonPath\":\"vmgxsab\",\"displayName\":\"qduujitcjczdz\",\"level\":\"Noisy\",\"description\":\"hkr\",\"oldValue\":\"d\",\"newValue\":\"p\",\"isDataMasked\":true}")
                .toObject(PropertyChange.class);
        Assertions.assertEquals(ChangeType.UPDATE, model.changeType());
        Assertions.assertEquals(ChangeCategory.SYSTEM, model.changeCategory());
        Assertions.assertEquals("vmgxsab", model.jsonPath());
        Assertions.assertEquals("qduujitcjczdz", model.displayName());
        Assertions.assertEquals(Level.NOISY, model.level());
        Assertions.assertEquals("hkr", model.description());
        Assertions.assertEquals("d", model.oldValue());
        Assertions.assertEquals("p", model.newValue());
        Assertions.assertEquals(true, model.isDataMasked());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        PropertyChange model =
            new PropertyChange()
                .withChangeType(ChangeType.UPDATE)
                .withChangeCategory(ChangeCategory.SYSTEM)
                .withJsonPath("vmgxsab")
                .withDisplayName("qduujitcjczdz")
                .withLevel(Level.NOISY)
                .withDescription("hkr")
                .withOldValue("d")
                .withNewValue("p")
                .withIsDataMasked(true);
        model = BinaryData.fromObject(model).toObject(PropertyChange.class);
        Assertions.assertEquals(ChangeType.UPDATE, model.changeType());
        Assertions.assertEquals(ChangeCategory.SYSTEM, model.changeCategory());
        Assertions.assertEquals("vmgxsab", model.jsonPath());
        Assertions.assertEquals("qduujitcjczdz", model.displayName());
        Assertions.assertEquals(Level.NOISY, model.level());
        Assertions.assertEquals("hkr", model.description());
        Assertions.assertEquals("d", model.oldValue());
        Assertions.assertEquals("p", model.newValue());
        Assertions.assertEquals(true, model.isDataMasked());
    }
}
