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

package com.azure.resourcemanager.iothub.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.iothub.models.IpFilterActionType;
import com.azure.resourcemanager.iothub.models.IpFilterRule;
import org.junit.jupiter.api.Assertions;

public final class IpFilterRuleTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        IpFilterRule model =
            BinaryData
                .fromString("{\"filterName\":\"git\",\"action\":\"Accept\",\"ipMask\":\"qhabifpikxwcz\"}")
                .toObject(IpFilterRule.class);
        Assertions.assertEquals("git", model.filterName());
        Assertions.assertEquals(IpFilterActionType.ACCEPT, model.action());
        Assertions.assertEquals("qhabifpikxwcz", model.ipMask());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        IpFilterRule model =
            new IpFilterRule().withFilterName("git").withAction(IpFilterActionType.ACCEPT).withIpMask("qhabifpikxwcz");
        model = BinaryData.fromObject(model).toObject(IpFilterRule.class);
        Assertions.assertEquals("git", model.filterName());
        Assertions.assertEquals(IpFilterActionType.ACCEPT, model.action());
        Assertions.assertEquals("qhabifpikxwcz", model.ipMask());
    }
}
