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

package com.azure.resourcemanager.iotfirmwaredefense.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.iotfirmwaredefense.fluent.models.CveInner;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;

public final class CveInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        CveInner model =
            BinaryData
                .fromString(
                    "{\"cveId\":\"rzayv\",\"component\":\"datapgvdf\",\"severity\":\"otkftutqxlngx\",\"name\":\"fgugnxkrxdqmid\",\"cvssScore\":\"hzrvqd\",\"cvssVersion\":\"bhj\",\"cvssV2Score\":\"igeho\",\"cvssV3Score\":\"bowsk\",\"publishDate\":\"2021-10-18T00:51:47Z\",\"updatedDate\":\"2020-12-21T07:17:40Z\",\"links\":[{\"href\":\"u\",\"label\":\"wgqyw\"},{\"href\":\"drvyn\",\"label\":\"gpphrcgyn\"},{\"href\":\"cpecfvmmcoofs\",\"label\":\"zevgb\"},{\"href\":\"jqabcypmivkwlzuv\",\"label\":\"fwnfnb\"}],\"description\":\"fionl\"}")
                .toObject(CveInner.class);
        Assertions.assertEquals("rzayv", model.cveId());
        Assertions.assertEquals("otkftutqxlngx", model.severity());
        Assertions.assertEquals("fgugnxkrxdqmid", model.name());
        Assertions.assertEquals("hzrvqd", model.cvssScore());
        Assertions.assertEquals("bhj", model.cvssVersion());
        Assertions.assertEquals("igeho", model.cvssV2Score());
        Assertions.assertEquals("bowsk", model.cvssV3Score());
        Assertions.assertEquals(OffsetDateTime.parse("2021-10-18T00:51:47Z"), model.publishDate());
        Assertions.assertEquals(OffsetDateTime.parse("2020-12-21T07:17:40Z"), model.updatedDate());
        Assertions.assertEquals("fionl", model.description());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        CveInner model =
            new CveInner()
                .withCveId("rzayv")
                .withComponent("datapgvdf")
                .withSeverity("otkftutqxlngx")
                .withName("fgugnxkrxdqmid")
                .withCvssScore("hzrvqd")
                .withCvssVersion("bhj")
                .withCvssV2Score("igeho")
                .withCvssV3Score("bowsk")
                .withPublishDate(OffsetDateTime.parse("2021-10-18T00:51:47Z"))
                .withUpdatedDate(OffsetDateTime.parse("2020-12-21T07:17:40Z"))
                .withDescription("fionl");
        model = BinaryData.fromObject(model).toObject(CveInner.class);
        Assertions.assertEquals("rzayv", model.cveId());
        Assertions.assertEquals("otkftutqxlngx", model.severity());
        Assertions.assertEquals("fgugnxkrxdqmid", model.name());
        Assertions.assertEquals("hzrvqd", model.cvssScore());
        Assertions.assertEquals("bhj", model.cvssVersion());
        Assertions.assertEquals("igeho", model.cvssV2Score());
        Assertions.assertEquals("bowsk", model.cvssV3Score());
        Assertions.assertEquals(OffsetDateTime.parse("2021-10-18T00:51:47Z"), model.publishDate());
        Assertions.assertEquals(OffsetDateTime.parse("2020-12-21T07:17:40Z"), model.updatedDate());
        Assertions.assertEquals("fionl", model.description());
    }
}
