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

package com.azure.resourcemanager.operationsmanagement.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.operationsmanagement.models.SolutionPatch;
import java.util.HashMap;
import java.util.Map;
import org.junit.jupiter.api.Assertions;

public final class SolutionPatchTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        SolutionPatch model =
            BinaryData
                .fromString(
                    "{\"tags\":{\"xrifkwmrvkts\":\"fsqesaagdfmglzlh\",\"ucmpoyfd\":\"zntocipaouajps\",\"s\":\"fogknygjofjdde\",\"jzyflu\":\"deupewnwrei\"}}")
                .toObject(SolutionPatch.class);
        Assertions.assertEquals("fsqesaagdfmglzlh", model.tags().get("xrifkwmrvkts"));
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        SolutionPatch model =
            new SolutionPatch()
                .withTags(
                    mapOf(
                        "xrifkwmrvkts",
                        "fsqesaagdfmglzlh",
                        "ucmpoyfd",
                        "zntocipaouajps",
                        "s",
                        "fogknygjofjdde",
                        "jzyflu",
                        "deupewnwrei"));
        model = BinaryData.fromObject(model).toObject(SolutionPatch.class);
        Assertions.assertEquals("fsqesaagdfmglzlh", model.tags().get("xrifkwmrvkts"));
    }

    @SuppressWarnings("unchecked")
    private static <T> Map<String, T> mapOf(Object... inputs) {
        Map<String, T> map = new HashMap<>();
        for (int i = 0; i < inputs.length; i += 2) {
            String key = (String) inputs[i];
            T value = (T) inputs[i + 1];
            map.put(key, value);
        }
        return map;
    }
}
