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

package com.azure.resourcemanager.security.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.security.fluent.models.SoftwareInner;
import com.azure.resourcemanager.security.models.EndOfSupportStatus;
import com.azure.resourcemanager.security.models.SoftwaresList;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class SoftwaresListTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        SoftwaresList model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"deviceId\":\"ubkmifo\",\"osPlatform\":\"ku\",\"vendor\":\"phavpmhbrb\",\"softwareName\":\"vgovpbbttefjokn\",\"version\":\"qyzqedikdfrdb\",\"endOfSupportStatus\":\"upcomingNoLongerSupported\",\"endOfSupportDate\":\"jgeihfqlggwfi\",\"numberOfKnownVulnerabilities\":864537987,\"firstSeenAt\":\"mjpb\"},\"id\":\"ephmgtvljvrcmyfq\",\"name\":\"pgxh\",\"type\":\"pomyqwcabvnuile\"}],\"nextLink\":\"aswlp\"}")
                .toObject(SoftwaresList.class);
        Assertions.assertEquals("ubkmifo", model.value().get(0).deviceId());
        Assertions.assertEquals("ku", model.value().get(0).osPlatform());
        Assertions.assertEquals("phavpmhbrb", model.value().get(0).vendor());
        Assertions.assertEquals("vgovpbbttefjokn", model.value().get(0).softwareName());
        Assertions.assertEquals("qyzqedikdfrdb", model.value().get(0).version());
        Assertions
            .assertEquals(EndOfSupportStatus.UPCOMING_NO_LONGER_SUPPORTED, model.value().get(0).endOfSupportStatus());
        Assertions.assertEquals("jgeihfqlggwfi", model.value().get(0).endOfSupportDate());
        Assertions.assertEquals(864537987, model.value().get(0).numberOfKnownVulnerabilities());
        Assertions.assertEquals("mjpb", model.value().get(0).firstSeenAt());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        SoftwaresList model =
            new SoftwaresList()
                .withValue(
                    Arrays
                        .asList(
                            new SoftwareInner()
                                .withDeviceId("ubkmifo")
                                .withOsPlatform("ku")
                                .withVendor("phavpmhbrb")
                                .withSoftwareName("vgovpbbttefjokn")
                                .withVersion("qyzqedikdfrdb")
                                .withEndOfSupportStatus(EndOfSupportStatus.UPCOMING_NO_LONGER_SUPPORTED)
                                .withEndOfSupportDate("jgeihfqlggwfi")
                                .withNumberOfKnownVulnerabilities(864537987)
                                .withFirstSeenAt("mjpb")));
        model = BinaryData.fromObject(model).toObject(SoftwaresList.class);
        Assertions.assertEquals("ubkmifo", model.value().get(0).deviceId());
        Assertions.assertEquals("ku", model.value().get(0).osPlatform());
        Assertions.assertEquals("phavpmhbrb", model.value().get(0).vendor());
        Assertions.assertEquals("vgovpbbttefjokn", model.value().get(0).softwareName());
        Assertions.assertEquals("qyzqedikdfrdb", model.value().get(0).version());
        Assertions
            .assertEquals(EndOfSupportStatus.UPCOMING_NO_LONGER_SUPPORTED, model.value().get(0).endOfSupportStatus());
        Assertions.assertEquals("jgeihfqlggwfi", model.value().get(0).endOfSupportDate());
        Assertions.assertEquals(864537987, model.value().get(0).numberOfKnownVulnerabilities());
        Assertions.assertEquals("mjpb", model.value().get(0).firstSeenAt());
    }
}
