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

package com.azure.resourcemanager.managednetworkfabric.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.managednetworkfabric.models.BfdConfiguration;
import com.azure.resourcemanager.managednetworkfabric.models.StaticRouteConfiguration;
import com.azure.resourcemanager.managednetworkfabric.models.StaticRouteProperties;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class StaticRouteConfigurationTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        StaticRouteConfiguration model =
            BinaryData
                .fromString(
                    "{\"bfdConfiguration\":{\"administrativeState\":\"Enabled\",\"interval\":829612504,\"multiplier\":1087078752},\"ipv4Routes\":[{\"prefix\":\"cxozapvhelxp\",\"nextHop\":[\"lya\",\"dd\",\"kcbcue\",\"rjxgciqib\"]},{\"prefix\":\"hos\",\"nextHop\":[\"dqrhzoymib\",\"rq\",\"ibahwflus\",\"dtmhrkwofyyvoqa\"]},{\"prefix\":\"piexpbtgiw\",\"nextHop\":[\"oenwashr\"]}],\"ipv6Routes\":[{\"prefix\":\"kcnqxwbpo\",\"nextHop\":[\"lpiujwaa\",\"ipqiiobyuqerpq\"]},{\"prefix\":\"pqwcciuqgbdbutau\",\"nextHop\":[\"btkuwhh\",\"hykojoxafnndlpic\",\"koymkcd\"]}]}")
                .toObject(StaticRouteConfiguration.class);
        Assertions.assertEquals("cxozapvhelxp", model.ipv4Routes().get(0).prefix());
        Assertions.assertEquals("lya", model.ipv4Routes().get(0).nextHop().get(0));
        Assertions.assertEquals("kcnqxwbpo", model.ipv6Routes().get(0).prefix());
        Assertions.assertEquals("lpiujwaa", model.ipv6Routes().get(0).nextHop().get(0));
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        StaticRouteConfiguration model =
            new StaticRouteConfiguration()
                .withBfdConfiguration(new BfdConfiguration())
                .withIpv4Routes(
                    Arrays
                        .asList(
                            new StaticRouteProperties()
                                .withPrefix("cxozapvhelxp")
                                .withNextHop(Arrays.asList("lya", "dd", "kcbcue", "rjxgciqib")),
                            new StaticRouteProperties()
                                .withPrefix("hos")
                                .withNextHop(Arrays.asList("dqrhzoymib", "rq", "ibahwflus", "dtmhrkwofyyvoqa")),
                            new StaticRouteProperties()
                                .withPrefix("piexpbtgiw")
                                .withNextHop(Arrays.asList("oenwashr"))))
                .withIpv6Routes(
                    Arrays
                        .asList(
                            new StaticRouteProperties()
                                .withPrefix("kcnqxwbpo")
                                .withNextHop(Arrays.asList("lpiujwaa", "ipqiiobyuqerpq")),
                            new StaticRouteProperties()
                                .withPrefix("pqwcciuqgbdbutau")
                                .withNextHop(Arrays.asList("btkuwhh", "hykojoxafnndlpic", "koymkcd"))));
        model = BinaryData.fromObject(model).toObject(StaticRouteConfiguration.class);
        Assertions.assertEquals("cxozapvhelxp", model.ipv4Routes().get(0).prefix());
        Assertions.assertEquals("lya", model.ipv4Routes().get(0).nextHop().get(0));
        Assertions.assertEquals("kcnqxwbpo", model.ipv6Routes().get(0).prefix());
        Assertions.assertEquals("lpiujwaa", model.ipv6Routes().get(0).nextHop().get(0));
    }
}
