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

package com.azure.resourcemanager.elastic.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.elastic.models.CompanyInfo;
import com.azure.resourcemanager.elastic.models.UserInfo;
import org.junit.jupiter.api.Assertions;

public final class UserInfoTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        UserInfo model =
            BinaryData
                .fromString(
                    "{\"firstName\":\"fmppe\",\"lastName\":\"vmgxsab\",\"companyName\":\"qduujitcjczdz\",\"emailAddress\":\"ndhkrw\",\"companyInfo\":{\"domain\":\"ppdsbdkvwrwj\",\"business\":\"usnhutje\",\"employeesNumber\":\"mrldhu\",\"state\":\"zzd\",\"country\":\"qxhocdgeablgphut\"}}")
                .toObject(UserInfo.class);
        Assertions.assertEquals("fmppe", model.firstName());
        Assertions.assertEquals("vmgxsab", model.lastName());
        Assertions.assertEquals("qduujitcjczdz", model.companyName());
        Assertions.assertEquals("ndhkrw", model.emailAddress());
        Assertions.assertEquals("ppdsbdkvwrwj", model.companyInfo().domain());
        Assertions.assertEquals("usnhutje", model.companyInfo().business());
        Assertions.assertEquals("mrldhu", model.companyInfo().employeesNumber());
        Assertions.assertEquals("zzd", model.companyInfo().state());
        Assertions.assertEquals("qxhocdgeablgphut", model.companyInfo().country());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        UserInfo model =
            new UserInfo()
                .withFirstName("fmppe")
                .withLastName("vmgxsab")
                .withCompanyName("qduujitcjczdz")
                .withEmailAddress("ndhkrw")
                .withCompanyInfo(
                    new CompanyInfo()
                        .withDomain("ppdsbdkvwrwj")
                        .withBusiness("usnhutje")
                        .withEmployeesNumber("mrldhu")
                        .withState("zzd")
                        .withCountry("qxhocdgeablgphut"));
        model = BinaryData.fromObject(model).toObject(UserInfo.class);
        Assertions.assertEquals("fmppe", model.firstName());
        Assertions.assertEquals("vmgxsab", model.lastName());
        Assertions.assertEquals("qduujitcjczdz", model.companyName());
        Assertions.assertEquals("ndhkrw", model.emailAddress());
        Assertions.assertEquals("ppdsbdkvwrwj", model.companyInfo().domain());
        Assertions.assertEquals("usnhutje", model.companyInfo().business());
        Assertions.assertEquals("mrldhu", model.companyInfo().employeesNumber());
        Assertions.assertEquals("zzd", model.companyInfo().state());
        Assertions.assertEquals("qxhocdgeablgphut", model.companyInfo().country());
    }
}
