diff --git a/sdk/commerce/azure-resourcemanager-commerce/CHANGELOG.md b/sdk/commerce/azure-resourcemanager-commerce/CHANGELOG.md index 0a5680f23ac86..03e59420419d0 100644 --- a/sdk/commerce/azure-resourcemanager-commerce/CHANGELOG.md +++ b/sdk/commerce/azure-resourcemanager-commerce/CHANGELOG.md @@ -1,6 +1,8 @@ # Release History -## 1.0.0-beta.3 (Unreleased) +## 1.0.0-beta.1 (2023-02-10) + +- Azure Resource Manager Usage client library for Java. This package contains Microsoft Azure SDK for Usage Management SDK. Package tag package-2015-06-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ### Features Added diff --git a/sdk/commerce/azure-resourcemanager-commerce/README.md b/sdk/commerce/azure-resourcemanager-commerce/README.md index 1ffcf3f44bb98..bf05ce5702117 100644 --- a/sdk/commerce/azure-resourcemanager-commerce/README.md +++ b/sdk/commerce/azure-resourcemanager-commerce/README.md @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-commerce - 1.0.0-beta.2 + 1.0.0-beta.3 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/UsageManager.java b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/UsageManager.java index 18dd7563788c5..6e9d174c2471c 100644 --- a/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/UsageManager.java +++ b/sdk/commerce/azure-resourcemanager-commerce/src/main/java/com/azure/resourcemanager/commerce/UsageManager.java @@ -207,7 +207,7 @@ public UsageManager authenticate(TokenCredential credential, AzureProfile profil .append("-") .append("com.azure.resourcemanager.commerce") .append("/") - .append("1.0.0-beta.2"); + .append("1.0.0-beta.1"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder .append(" (") diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/InfoFieldTests.java b/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/InfoFieldTests.java deleted file mode 100644 index ff4414b389b1f..0000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/InfoFieldTests.java +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.commerce.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.commerce.models.InfoField; -import org.junit.jupiter.api.Assertions; - -public final class InfoFieldTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - InfoField model = BinaryData.fromString("{\"project\":\"slwejdpvw\"}").toObject(InfoField.class); - Assertions.assertEquals("slwejdpvw", model.project()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - InfoField model = new InfoField().withProject("slwejdpvw"); - model = BinaryData.fromObject(model).toObject(InfoField.class); - Assertions.assertEquals("slwejdpvw", model.project()); - } -} diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/MeterInfoTests.java b/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/MeterInfoTests.java deleted file mode 100644 index 9c36cdc863fa5..0000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/MeterInfoTests.java +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.commerce.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.commerce.models.MeterInfo; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; - -public final class MeterInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MeterInfo model = - BinaryData - .fromString( - "{\"MeterId\":\"02c5a81b-ee19-4c50-bb4c-6805c59050b2\",\"MeterName\":\"gls\",\"MeterCategory\":\"inqpjwnzll\",\"MeterSubCategory\":\"mppeebvmgxs\",\"Unit\":\"kyqduujit\",\"MeterTags\":[\"zdzevndh\",\"rwpdappdsbdkvwrw\"],\"MeterRegion\":\"eusnhutj\",\"MeterRates\":{\"rl\":33.49618,\"ugjzzdatqxhocdge\":86.19471,\"lgphu\":56.39705,\"cndvkaozwyiftyhx\":89.55463},\"EffectiveDate\":\"2021-01-28T13:33:14Z\",\"IncludedQuantity\":5.188751}") - .toObject(MeterInfo.class); - Assertions.assertEquals(UUID.fromString("02c5a81b-ee19-4c50-bb4c-6805c59050b2"), model.meterId()); - Assertions.assertEquals("gls", model.meterName()); - Assertions.assertEquals("inqpjwnzll", model.meterCategory()); - Assertions.assertEquals("mppeebvmgxs", model.meterSubCategory()); - Assertions.assertEquals("kyqduujit", model.unit()); - Assertions.assertEquals("zdzevndh", model.meterTags().get(0)); - Assertions.assertEquals("eusnhutj", model.meterRegion()); - Assertions.assertEquals(33.49618f, model.meterRates().get("rl")); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-28T13:33:14Z"), model.effectiveDate()); - Assertions.assertEquals(5.188751F, model.includedQuantity()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MeterInfo model = - new MeterInfo() - .withMeterId(UUID.fromString("02c5a81b-ee19-4c50-bb4c-6805c59050b2")) - .withMeterName("gls") - .withMeterCategory("inqpjwnzll") - .withMeterSubCategory("mppeebvmgxs") - .withUnit("kyqduujit") - .withMeterTags(Arrays.asList("zdzevndh", "rwpdappdsbdkvwrw")) - .withMeterRegion("eusnhutj") - .withMeterRates( - mapOf( - "rl", - 33.49618f, - "ugjzzdatqxhocdge", - 86.19471f, - "lgphu", - 56.39705f, - "cndvkaozwyiftyhx", - 89.55463f)) - .withEffectiveDate(OffsetDateTime.parse("2021-01-28T13:33:14Z")) - .withIncludedQuantity(5.188751F); - model = BinaryData.fromObject(model).toObject(MeterInfo.class); - Assertions.assertEquals(UUID.fromString("02c5a81b-ee19-4c50-bb4c-6805c59050b2"), model.meterId()); - Assertions.assertEquals("gls", model.meterName()); - Assertions.assertEquals("inqpjwnzll", model.meterCategory()); - Assertions.assertEquals("mppeebvmgxs", model.meterSubCategory()); - Assertions.assertEquals("kyqduujit", model.unit()); - Assertions.assertEquals("zdzevndh", model.meterTags().get(0)); - Assertions.assertEquals("eusnhutj", model.meterRegion()); - Assertions.assertEquals(33.49618f, model.meterRates().get("rl")); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-28T13:33:14Z"), model.effectiveDate()); - Assertions.assertEquals(5.188751F, model.includedQuantity()); - } - - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map 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; - } -} diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/MonetaryCommitmentTests.java b/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/MonetaryCommitmentTests.java deleted file mode 100644 index 473481fa667aa..0000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/MonetaryCommitmentTests.java +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.commerce.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.commerce.models.MonetaryCommitment; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; - -public final class MonetaryCommitmentTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MonetaryCommitment model = - BinaryData - .fromString( - "{\"Name\":\"Monetary" - + " Commitment\",\"TieredDiscount\":{},\"ExcludedMeterIds\":[\"1aa0f45b-4326-4b78-b0fa-9687c4611286\",\"a60e66b9-10f9-4a92-a7aa-2bf3d302a701\",\"c826acba-6f28-454d-aae4-42fa65ea852b\",\"9baf4d39-7eb5-409a-be03-328ec7b54019\"],\"EffectiveDate\":\"2021-06-11T05:03:33Z\"}") - .toObject(MonetaryCommitment.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-11T05:03:33Z"), model.effectiveDate()); - Assertions - .assertEquals(UUID.fromString("1aa0f45b-4326-4b78-b0fa-9687c4611286"), model.excludedMeterIds().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MonetaryCommitment model = - new MonetaryCommitment() - .withEffectiveDate(OffsetDateTime.parse("2021-06-11T05:03:33Z")) - .withTieredDiscount(mapOf()) - .withExcludedMeterIds( - Arrays - .asList( - UUID.fromString("1aa0f45b-4326-4b78-b0fa-9687c4611286"), - UUID.fromString("a60e66b9-10f9-4a92-a7aa-2bf3d302a701"), - UUID.fromString("c826acba-6f28-454d-aae4-42fa65ea852b"), - UUID.fromString("9baf4d39-7eb5-409a-be03-328ec7b54019"))); - model = BinaryData.fromObject(model).toObject(MonetaryCommitment.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-11T05:03:33Z"), model.effectiveDate()); - Assertions - .assertEquals(UUID.fromString("1aa0f45b-4326-4b78-b0fa-9687c4611286"), model.excludedMeterIds().get(0)); - } - - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map 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; - } -} diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/MonetaryCreditTests.java b/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/MonetaryCreditTests.java deleted file mode 100644 index 778a0ece030db..0000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/MonetaryCreditTests.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.commerce.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.commerce.models.MonetaryCredit; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; - -public final class MonetaryCreditTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MonetaryCredit model = - BinaryData - .fromString( - "{\"Name\":\"Monetary" - + " Credit\",\"ExcludedMeterIds\":[\"ab7692b8-06a7-4e11-81ad-8c3c5575f463\",\"f7a4db67-3ed6-4b5a-a329-21f2a6ac6a4a\"],\"EffectiveDate\":\"2021-07-03T12:16:15Z\"}") - .toObject(MonetaryCredit.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-03T12:16:15Z"), model.effectiveDate()); - Assertions - .assertEquals(UUID.fromString("ab7692b8-06a7-4e11-81ad-8c3c5575f463"), model.excludedMeterIds().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MonetaryCredit model = - new MonetaryCredit() - .withEffectiveDate(OffsetDateTime.parse("2021-07-03T12:16:15Z")) - .withExcludedMeterIds( - Arrays - .asList( - UUID.fromString("ab7692b8-06a7-4e11-81ad-8c3c5575f463"), - UUID.fromString("f7a4db67-3ed6-4b5a-a329-21f2a6ac6a4a"))); - model = BinaryData.fromObject(model).toObject(MonetaryCredit.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-03T12:16:15Z"), model.effectiveDate()); - Assertions - .assertEquals(UUID.fromString("ab7692b8-06a7-4e11-81ad-8c3c5575f463"), model.excludedMeterIds().get(0)); - } -} diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/OfferTermInfoAutoGeneratedTests.java b/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/OfferTermInfoAutoGeneratedTests.java deleted file mode 100644 index 5b674fc8ad071..0000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/OfferTermInfoAutoGeneratedTests.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.commerce.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.commerce.models.OfferTermInfoAutoGenerated; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class OfferTermInfoAutoGeneratedTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OfferTermInfoAutoGenerated model = - BinaryData - .fromString("{\"Name\":\"OfferTermInfoAutoGenerated\",\"EffectiveDate\":\"2021-04-23T06:59:32Z\"}") - .toObject(OfferTermInfoAutoGenerated.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-04-23T06:59:32Z"), model.effectiveDate()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OfferTermInfoAutoGenerated model = - new OfferTermInfoAutoGenerated().withEffectiveDate(OffsetDateTime.parse("2021-04-23T06:59:32Z")); - model = BinaryData.fromObject(model).toObject(OfferTermInfoAutoGenerated.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-04-23T06:59:32Z"), model.effectiveDate()); - } -} diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/RateCardsGetWithResponseMockTests.java b/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/RateCardsGetWithResponseMockTests.java deleted file mode 100644 index 62831393e8efe..0000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/RateCardsGetWithResponseMockTests.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.commerce.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.commerce.UsageManager; -import com.azure.resourcemanager.commerce.models.ResourceRateCardInfo; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class RateCardsGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"Currency\":\"ypl\",\"Locale\":\"kbasyypn\",\"IsTaxIncluded\":true,\"OfferTerms\":[{\"Name\":\"OfferTermInfoAutoGenerated\",\"EffectiveDate\":\"2021-11-24T04:31Z\"},{\"Name\":\"OfferTermInfoAutoGenerated\",\"EffectiveDate\":\"2021-03-24T00:19:08Z\"},{\"Name\":\"OfferTermInfoAutoGenerated\",\"EffectiveDate\":\"2021-12-07T05:26:51Z\"}],\"Meters\":[{\"MeterId\":\"b3250b1c-d2dd-4892-a595-82de8cc6e56e\",\"MeterName\":\"tynqgoul\",\"MeterCategory\":\"dlikwyqkgfgibma\",\"MeterSubCategory\":\"akeqs\",\"Unit\":\"yb\",\"MeterTags\":[\"e\",\"qytbciq\",\"ouf\",\"mmnkzsmodmgl\"],\"MeterRegion\":\"gpbkwtmut\",\"MeterRates\":{\"ta\":85.38377,\"pwgcuertu\":94.51547,\"dosvqwhbmdgbbjf\":38.05988,\"gmbmbexppbh\":21.297592},\"EffectiveDate\":\"2021-09-17T16:41:16Z\",\"IncludedQuantity\":8.5479145}]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - UsageManager manager = - UsageManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ResourceRateCardInfo response = - manager.rateCards().getWithResponse("fkgiawxk", com.azure.core.util.Context.NONE).getValue(); - - Assertions.assertEquals("ypl", response.currency()); - Assertions.assertEquals("kbasyypn", response.locale()); - Assertions.assertEquals(true, response.isTaxIncluded()); - Assertions - .assertEquals(OffsetDateTime.parse("2021-11-24T04:31Z"), response.offerTerms().get(0).effectiveDate()); - Assertions - .assertEquals(UUID.fromString("b3250b1c-d2dd-4892-a595-82de8cc6e56e"), response.meters().get(0).meterId()); - Assertions.assertEquals("tynqgoul", response.meters().get(0).meterName()); - Assertions.assertEquals("dlikwyqkgfgibma", response.meters().get(0).meterCategory()); - Assertions.assertEquals("akeqs", response.meters().get(0).meterSubCategory()); - Assertions.assertEquals("yb", response.meters().get(0).unit()); - Assertions.assertEquals("e", response.meters().get(0).meterTags().get(0)); - Assertions.assertEquals("gpbkwtmut", response.meters().get(0).meterRegion()); - Assertions.assertEquals(85.38377f, response.meters().get(0).meterRates().get("ta")); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-17T16:41:16Z"), response.meters().get(0).effectiveDate()); - Assertions.assertEquals(8.5479145F, response.meters().get(0).includedQuantity()); - } -} diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/RecurringChargeTests.java b/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/RecurringChargeTests.java deleted file mode 100644 index 408ff2154c295..0000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/RecurringChargeTests.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.commerce.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.commerce.models.RecurringCharge; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class RecurringChargeTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - RecurringCharge model = - BinaryData - .fromString( - "{\"Name\":\"Recurring" - + " Charge\",\"RecurringCharge\":1084941449,\"EffectiveDate\":\"2021-01-26T04:33:28Z\"}") - .toObject(RecurringCharge.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-26T04:33:28Z"), model.effectiveDate()); - Assertions.assertEquals(1084941449, model.recurringCharge()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - RecurringCharge model = - new RecurringCharge() - .withEffectiveDate(OffsetDateTime.parse("2021-01-26T04:33:28Z")) - .withRecurringCharge(1084941449); - model = BinaryData.fromObject(model).toObject(RecurringCharge.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-26T04:33:28Z"), model.effectiveDate()); - Assertions.assertEquals(1084941449, model.recurringCharge()); - } -} diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/ResourceRateCardInfoInnerTests.java b/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/ResourceRateCardInfoInnerTests.java deleted file mode 100644 index 5764dcde4ee3b..0000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/ResourceRateCardInfoInnerTests.java +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.commerce.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.commerce.fluent.models.ResourceRateCardInfoInner; -import com.azure.resourcemanager.commerce.models.MeterInfo; -import com.azure.resourcemanager.commerce.models.OfferTermInfoAutoGenerated; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; - -public final class ResourceRateCardInfoInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ResourceRateCardInfoInner model = - BinaryData - .fromString( - "{\"Currency\":\"oqpsoa\",\"Locale\":\"tazak\",\"IsTaxIncluded\":true,\"OfferTerms\":[{\"Name\":\"OfferTermInfoAutoGenerated\",\"EffectiveDate\":\"2021-06-15T07:28:27Z\"},{\"Name\":\"OfferTermInfoAutoGenerated\",\"EffectiveDate\":\"2021-10-01T21:39:25Z\"},{\"Name\":\"OfferTermInfoAutoGenerated\",\"EffectiveDate\":\"2021-02-13T07:50:35Z\"},{\"Name\":\"OfferTermInfoAutoGenerated\",\"EffectiveDate\":\"2021-07-14T10:08:19Z\"}],\"Meters\":[{\"MeterId\":\"21c454b4-9be1-44a4-8275-74ca26236155\",\"MeterName\":\"gexpaojakhmsbz\",\"MeterCategory\":\"crzevdphlx\",\"MeterSubCategory\":\"lthqtrgqjbp\",\"Unit\":\"fsinzgvfcjrwzoxx\",\"MeterTags\":[\"elluwfziton\",\"eqfpj\",\"jlxofpdvhpfxxyp\",\"ninmayhuyb\"],\"MeterRegion\":\"podepoo\",\"MeterRates\":{\"vamih\":94.223724,\"gnarxzxtheo\":92.43863,\"si\":35.96248},\"EffectiveDate\":\"2021-11-04T11:49:42Z\",\"IncludedQuantity\":90.02525},{\"MeterId\":\"7c95010f-59ae-4879-bbc0-077e4df6540f\",\"MeterName\":\"qi\",\"MeterCategory\":\"hungbwjzrnf\",\"MeterSubCategory\":\"xgispemvtzfkufu\",\"Unit\":\"jofxqe\",\"MeterTags\":[\"aeqjhqjbasvms\"],\"MeterRegion\":\"qulngsntnbybkzgc\",\"MeterRates\":{\"lxxwrljdouskc\":57.128227,\"kocrcjdkwtnhx\":70.357445},\"EffectiveDate\":\"2020-12-31T19:07:05Z\",\"IncludedQuantity\":30.74364}]}") - .toObject(ResourceRateCardInfoInner.class); - Assertions.assertEquals("oqpsoa", model.currency()); - Assertions.assertEquals("tazak", model.locale()); - Assertions.assertEquals(true, model.isTaxIncluded()); - Assertions - .assertEquals(OffsetDateTime.parse("2021-06-15T07:28:27Z"), model.offerTerms().get(0).effectiveDate()); - Assertions - .assertEquals(UUID.fromString("21c454b4-9be1-44a4-8275-74ca26236155"), model.meters().get(0).meterId()); - Assertions.assertEquals("gexpaojakhmsbz", model.meters().get(0).meterName()); - Assertions.assertEquals("crzevdphlx", model.meters().get(0).meterCategory()); - Assertions.assertEquals("lthqtrgqjbp", model.meters().get(0).meterSubCategory()); - Assertions.assertEquals("fsinzgvfcjrwzoxx", model.meters().get(0).unit()); - Assertions.assertEquals("elluwfziton", model.meters().get(0).meterTags().get(0)); - Assertions.assertEquals("podepoo", model.meters().get(0).meterRegion()); - Assertions.assertEquals(94.223724f, model.meters().get(0).meterRates().get("vamih")); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-04T11:49:42Z"), model.meters().get(0).effectiveDate()); - Assertions.assertEquals(90.02525F, model.meters().get(0).includedQuantity()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ResourceRateCardInfoInner model = - new ResourceRateCardInfoInner() - .withCurrency("oqpsoa") - .withLocale("tazak") - .withIsTaxIncluded(true) - .withOfferTerms( - Arrays - .asList( - new OfferTermInfoAutoGenerated() - .withEffectiveDate(OffsetDateTime.parse("2021-06-15T07:28:27Z")), - new OfferTermInfoAutoGenerated() - .withEffectiveDate(OffsetDateTime.parse("2021-10-01T21:39:25Z")), - new OfferTermInfoAutoGenerated() - .withEffectiveDate(OffsetDateTime.parse("2021-02-13T07:50:35Z")), - new OfferTermInfoAutoGenerated() - .withEffectiveDate(OffsetDateTime.parse("2021-07-14T10:08:19Z")))) - .withMeters( - Arrays - .asList( - new MeterInfo() - .withMeterId(UUID.fromString("21c454b4-9be1-44a4-8275-74ca26236155")) - .withMeterName("gexpaojakhmsbz") - .withMeterCategory("crzevdphlx") - .withMeterSubCategory("lthqtrgqjbp") - .withUnit("fsinzgvfcjrwzoxx") - .withMeterTags(Arrays.asList("elluwfziton", "eqfpj", "jlxofpdvhpfxxyp", "ninmayhuyb")) - .withMeterRegion("podepoo") - .withMeterRates(mapOf("vamih", 94.223724f, "gnarxzxtheo", 92.43863f, "si", 35.96248f)) - .withEffectiveDate(OffsetDateTime.parse("2021-11-04T11:49:42Z")) - .withIncludedQuantity(90.02525F), - new MeterInfo() - .withMeterId(UUID.fromString("7c95010f-59ae-4879-bbc0-077e4df6540f")) - .withMeterName("qi") - .withMeterCategory("hungbwjzrnf") - .withMeterSubCategory("xgispemvtzfkufu") - .withUnit("jofxqe") - .withMeterTags(Arrays.asList("aeqjhqjbasvms")) - .withMeterRegion("qulngsntnbybkzgc") - .withMeterRates(mapOf("lxxwrljdouskc", 57.128227f, "kocrcjdkwtnhx", 70.357445f)) - .withEffectiveDate(OffsetDateTime.parse("2020-12-31T19:07:05Z")) - .withIncludedQuantity(30.74364F))); - model = BinaryData.fromObject(model).toObject(ResourceRateCardInfoInner.class); - Assertions.assertEquals("oqpsoa", model.currency()); - Assertions.assertEquals("tazak", model.locale()); - Assertions.assertEquals(true, model.isTaxIncluded()); - Assertions - .assertEquals(OffsetDateTime.parse("2021-06-15T07:28:27Z"), model.offerTerms().get(0).effectiveDate()); - Assertions - .assertEquals(UUID.fromString("21c454b4-9be1-44a4-8275-74ca26236155"), model.meters().get(0).meterId()); - Assertions.assertEquals("gexpaojakhmsbz", model.meters().get(0).meterName()); - Assertions.assertEquals("crzevdphlx", model.meters().get(0).meterCategory()); - Assertions.assertEquals("lthqtrgqjbp", model.meters().get(0).meterSubCategory()); - Assertions.assertEquals("fsinzgvfcjrwzoxx", model.meters().get(0).unit()); - Assertions.assertEquals("elluwfziton", model.meters().get(0).meterTags().get(0)); - Assertions.assertEquals("podepoo", model.meters().get(0).meterRegion()); - Assertions.assertEquals(94.223724f, model.meters().get(0).meterRates().get("vamih")); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-04T11:49:42Z"), model.meters().get(0).effectiveDate()); - Assertions.assertEquals(90.02525F, model.meters().get(0).includedQuantity()); - } - - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map 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; - } -} diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/UsageAggregationInnerTests.java b/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/UsageAggregationInnerTests.java deleted file mode 100644 index 8e7696669ab66..0000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/UsageAggregationInnerTests.java +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.commerce.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.commerce.fluent.models.UsageAggregationInner; -import com.azure.resourcemanager.commerce.models.InfoField; -import java.time.OffsetDateTime; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; - -public final class UsageAggregationInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - UsageAggregationInner model = - BinaryData - .fromString( - "{\"id\":\"git\",\"name\":\"qhabifpikxwcz\",\"type\":\"scnpqxuhivy\",\"properties\":{\"subscriptionId\":\"f6de8516-24e1-45ed-82b6-e06fea31b82a\",\"meterId\":\"b\",\"usageStartTime\":\"2021-06-19T13:57:47Z\",\"usageEndTime\":\"2021-06-14T11:48:10Z\",\"quantity\":69.25819,\"unit\":\"mjgr\",\"meterName\":\"wvukx\",\"meterCategory\":\"udccsnhsjc\",\"meterSubCategory\":\"ejhkry\",\"meterRegion\":\"napczwlokjy\",\"infoFields\":{\"project\":\"kvnipjoxz\"},\"instanceData\":\"chgejspodm\"}}") - .toObject(UsageAggregationInner.class); - Assertions.assertEquals("git", model.id()); - Assertions.assertEquals("qhabifpikxwcz", model.name()); - Assertions.assertEquals("scnpqxuhivy", model.type()); - Assertions.assertEquals(UUID.fromString("f6de8516-24e1-45ed-82b6-e06fea31b82a"), model.subscriptionId()); - Assertions.assertEquals("b", model.meterId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-19T13:57:47Z"), model.usageStartTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-14T11:48:10Z"), model.usageEndTime()); - Assertions.assertEquals(69.25819F, model.quantity()); - Assertions.assertEquals("mjgr", model.unit()); - Assertions.assertEquals("wvukx", model.meterName()); - Assertions.assertEquals("udccsnhsjc", model.meterCategory()); - Assertions.assertEquals("ejhkry", model.meterSubCategory()); - Assertions.assertEquals("napczwlokjy", model.meterRegion()); - Assertions.assertEquals("kvnipjoxz", model.infoFields().project()); - Assertions.assertEquals("chgejspodm", model.instanceData()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - UsageAggregationInner model = - new UsageAggregationInner() - .withId("git") - .withName("qhabifpikxwcz") - .withType("scnpqxuhivy") - .withSubscriptionId(UUID.fromString("f6de8516-24e1-45ed-82b6-e06fea31b82a")) - .withMeterId("b") - .withUsageStartTime(OffsetDateTime.parse("2021-06-19T13:57:47Z")) - .withUsageEndTime(OffsetDateTime.parse("2021-06-14T11:48:10Z")) - .withQuantity(69.25819F) - .withUnit("mjgr") - .withMeterName("wvukx") - .withMeterCategory("udccsnhsjc") - .withMeterSubCategory("ejhkry") - .withMeterRegion("napczwlokjy") - .withInfoFields(new InfoField().withProject("kvnipjoxz")) - .withInstanceData("chgejspodm"); - model = BinaryData.fromObject(model).toObject(UsageAggregationInner.class); - Assertions.assertEquals("git", model.id()); - Assertions.assertEquals("qhabifpikxwcz", model.name()); - Assertions.assertEquals("scnpqxuhivy", model.type()); - Assertions.assertEquals(UUID.fromString("f6de8516-24e1-45ed-82b6-e06fea31b82a"), model.subscriptionId()); - Assertions.assertEquals("b", model.meterId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-19T13:57:47Z"), model.usageStartTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-14T11:48:10Z"), model.usageEndTime()); - Assertions.assertEquals(69.25819F, model.quantity()); - Assertions.assertEquals("mjgr", model.unit()); - Assertions.assertEquals("wvukx", model.meterName()); - Assertions.assertEquals("udccsnhsjc", model.meterCategory()); - Assertions.assertEquals("ejhkry", model.meterSubCategory()); - Assertions.assertEquals("napczwlokjy", model.meterRegion()); - Assertions.assertEquals("kvnipjoxz", model.infoFields().project()); - Assertions.assertEquals("chgejspodm", model.instanceData()); - } -} diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/UsageAggregationListResultTests.java b/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/UsageAggregationListResultTests.java deleted file mode 100644 index b482c8c79d117..0000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/UsageAggregationListResultTests.java +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.commerce.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.commerce.fluent.models.UsageAggregationInner; -import com.azure.resourcemanager.commerce.models.UsageAggregationListResult; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; - -public final class UsageAggregationListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - UsageAggregationListResult model = - BinaryData - .fromString( - "{\"value\":[{\"id\":\"quvgjxpybczme\",\"name\":\"tzopbsphrupidgsy\",\"type\":\"ejhphoyc\",\"properties\":{\"subscriptionId\":\"99348804-291c-4340-9004-5c0e38008bae\",\"meterId\":\"obhdxbmtqioqjze\",\"usageStartTime\":\"2021-01-14T01:11:27Z\",\"usageEndTime\":\"2021-03-02T03:48:42Z\",\"quantity\":6.097913,\"unit\":\"wnoi\",\"meterName\":\"wlrxyb\",\"meterCategory\":\"oqijgkdmbpaz\",\"meterSubCategory\":\"bc\",\"meterRegion\":\"pdznrbtcqqjnqgl\",\"instanceData\":\"nufo\"}},{\"id\":\"jywif\",\"name\":\"esaagdfm\",\"type\":\"zlhjxrifkwmrvkt\",\"properties\":{\"subscriptionId\":\"1c9a61f5-07a2-48b5-a039-b38ffa691c18\",\"meterId\":\"to\",\"usageStartTime\":\"2021-11-17T06:57:14Z\",\"usageEndTime\":\"2021-01-23T08:07:58Z\",\"quantity\":42.458458,\"unit\":\"psqucmpoyf\",\"meterName\":\"fogknygjofjdde\",\"meterCategory\":\"rd\",\"meterSubCategory\":\"pewnw\",\"meterRegion\":\"itjz\",\"instanceData\":\"usarhmofc\"}},{\"id\":\"smy\",\"name\":\"kdtmlxhekuk\",\"type\":\"txukcdmp\",\"properties\":{\"subscriptionId\":\"cf09efcc-695d-425b-b772-a9f354d422c6\",\"meterId\":\"y\",\"usageStartTime\":\"2021-11-03T04:50:08Z\",\"usageEndTime\":\"2021-03-23T07:07:23Z\",\"quantity\":80.46482,\"unit\":\"dxtayrlhm\",\"meterName\":\"fp\",\"meterCategory\":\"qobmtukk\",\"meterSubCategory\":\"yrtih\",\"meterRegion\":\"tijbpzvgnwzsymgl\",\"instanceData\":\"cyzkohdbihanuf\"}}],\"nextLink\":\"cbjy\"}") - .toObject(UsageAggregationListResult.class); - Assertions.assertEquals("quvgjxpybczme", model.value().get(0).id()); - Assertions.assertEquals("tzopbsphrupidgsy", model.value().get(0).name()); - Assertions.assertEquals("ejhphoyc", model.value().get(0).type()); - Assertions - .assertEquals( - UUID.fromString("99348804-291c-4340-9004-5c0e38008bae"), model.value().get(0).subscriptionId()); - Assertions.assertEquals("obhdxbmtqioqjze", model.value().get(0).meterId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-14T01:11:27Z"), model.value().get(0).usageStartTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-02T03:48:42Z"), model.value().get(0).usageEndTime()); - Assertions.assertEquals(6.097913F, model.value().get(0).quantity()); - Assertions.assertEquals("wnoi", model.value().get(0).unit()); - Assertions.assertEquals("wlrxyb", model.value().get(0).meterName()); - Assertions.assertEquals("oqijgkdmbpaz", model.value().get(0).meterCategory()); - Assertions.assertEquals("bc", model.value().get(0).meterSubCategory()); - Assertions.assertEquals("pdznrbtcqqjnqgl", model.value().get(0).meterRegion()); - Assertions.assertEquals("nufo", model.value().get(0).instanceData()); - Assertions.assertEquals("cbjy", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - UsageAggregationListResult model = - new UsageAggregationListResult() - .withValue( - Arrays - .asList( - new UsageAggregationInner() - .withId("quvgjxpybczme") - .withName("tzopbsphrupidgsy") - .withType("ejhphoyc") - .withSubscriptionId(UUID.fromString("99348804-291c-4340-9004-5c0e38008bae")) - .withMeterId("obhdxbmtqioqjze") - .withUsageStartTime(OffsetDateTime.parse("2021-01-14T01:11:27Z")) - .withUsageEndTime(OffsetDateTime.parse("2021-03-02T03:48:42Z")) - .withQuantity(6.097913F) - .withUnit("wnoi") - .withMeterName("wlrxyb") - .withMeterCategory("oqijgkdmbpaz") - .withMeterSubCategory("bc") - .withMeterRegion("pdznrbtcqqjnqgl") - .withInstanceData("nufo"), - new UsageAggregationInner() - .withId("jywif") - .withName("esaagdfm") - .withType("zlhjxrifkwmrvkt") - .withSubscriptionId(UUID.fromString("1c9a61f5-07a2-48b5-a039-b38ffa691c18")) - .withMeterId("to") - .withUsageStartTime(OffsetDateTime.parse("2021-11-17T06:57:14Z")) - .withUsageEndTime(OffsetDateTime.parse("2021-01-23T08:07:58Z")) - .withQuantity(42.458458F) - .withUnit("psqucmpoyf") - .withMeterName("fogknygjofjdde") - .withMeterCategory("rd") - .withMeterSubCategory("pewnw") - .withMeterRegion("itjz") - .withInstanceData("usarhmofc"), - new UsageAggregationInner() - .withId("smy") - .withName("kdtmlxhekuk") - .withType("txukcdmp") - .withSubscriptionId(UUID.fromString("cf09efcc-695d-425b-b772-a9f354d422c6")) - .withMeterId("y") - .withUsageStartTime(OffsetDateTime.parse("2021-11-03T04:50:08Z")) - .withUsageEndTime(OffsetDateTime.parse("2021-03-23T07:07:23Z")) - .withQuantity(80.46482F) - .withUnit("dxtayrlhm") - .withMeterName("fp") - .withMeterCategory("qobmtukk") - .withMeterSubCategory("yrtih") - .withMeterRegion("tijbpzvgnwzsymgl") - .withInstanceData("cyzkohdbihanuf"))) - .withNextLink("cbjy"); - model = BinaryData.fromObject(model).toObject(UsageAggregationListResult.class); - Assertions.assertEquals("quvgjxpybczme", model.value().get(0).id()); - Assertions.assertEquals("tzopbsphrupidgsy", model.value().get(0).name()); - Assertions.assertEquals("ejhphoyc", model.value().get(0).type()); - Assertions - .assertEquals( - UUID.fromString("99348804-291c-4340-9004-5c0e38008bae"), model.value().get(0).subscriptionId()); - Assertions.assertEquals("obhdxbmtqioqjze", model.value().get(0).meterId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-14T01:11:27Z"), model.value().get(0).usageStartTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-02T03:48:42Z"), model.value().get(0).usageEndTime()); - Assertions.assertEquals(6.097913F, model.value().get(0).quantity()); - Assertions.assertEquals("wnoi", model.value().get(0).unit()); - Assertions.assertEquals("wlrxyb", model.value().get(0).meterName()); - Assertions.assertEquals("oqijgkdmbpaz", model.value().get(0).meterCategory()); - Assertions.assertEquals("bc", model.value().get(0).meterSubCategory()); - Assertions.assertEquals("pdznrbtcqqjnqgl", model.value().get(0).meterRegion()); - Assertions.assertEquals("nufo", model.value().get(0).instanceData()); - Assertions.assertEquals("cbjy", model.nextLink()); - } -} diff --git a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/UsageSampleTests.java b/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/UsageSampleTests.java deleted file mode 100644 index 4055b1d4dee88..0000000000000 --- a/sdk/commerce/azure-resourcemanager-commerce/src/test/java/com/azure/resourcemanager/commerce/generated/UsageSampleTests.java +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.commerce.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.commerce.fluent.models.UsageSample; -import com.azure.resourcemanager.commerce.models.InfoField; -import java.time.OffsetDateTime; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; - -public final class UsageSampleTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - UsageSample model = - BinaryData - .fromString( - "{\"subscriptionId\":\"31f9d37f-ba99-4b53-b5f1-186a76a93523\",\"meterId\":\"zyde\",\"usageStartTime\":\"2021-05-18T09:45:02Z\",\"usageEndTime\":\"2021-05-10T11:45:10Z\",\"quantity\":57.05146,\"unit\":\"xinpmqnjaq\",\"meterName\":\"xj\",\"meterCategory\":\"r\",\"meterSubCategory\":\"vcputegj\",\"meterRegion\":\"mfdatscmdvpj\",\"infoFields\":{\"project\":\"suuv\"},\"instanceData\":\"jozkrwfndiod\"}") - .toObject(UsageSample.class); - Assertions.assertEquals(UUID.fromString("31f9d37f-ba99-4b53-b5f1-186a76a93523"), model.subscriptionId()); - Assertions.assertEquals("zyde", model.meterId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-18T09:45:02Z"), model.usageStartTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-10T11:45:10Z"), model.usageEndTime()); - Assertions.assertEquals(57.05146F, model.quantity()); - Assertions.assertEquals("xinpmqnjaq", model.unit()); - Assertions.assertEquals("xj", model.meterName()); - Assertions.assertEquals("r", model.meterCategory()); - Assertions.assertEquals("vcputegj", model.meterSubCategory()); - Assertions.assertEquals("mfdatscmdvpj", model.meterRegion()); - Assertions.assertEquals("suuv", model.infoFields().project()); - Assertions.assertEquals("jozkrwfndiod", model.instanceData()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - UsageSample model = - new UsageSample() - .withSubscriptionId(UUID.fromString("31f9d37f-ba99-4b53-b5f1-186a76a93523")) - .withMeterId("zyde") - .withUsageStartTime(OffsetDateTime.parse("2021-05-18T09:45:02Z")) - .withUsageEndTime(OffsetDateTime.parse("2021-05-10T11:45:10Z")) - .withQuantity(57.05146F) - .withUnit("xinpmqnjaq") - .withMeterName("xj") - .withMeterCategory("r") - .withMeterSubCategory("vcputegj") - .withMeterRegion("mfdatscmdvpj") - .withInfoFields(new InfoField().withProject("suuv")) - .withInstanceData("jozkrwfndiod"); - model = BinaryData.fromObject(model).toObject(UsageSample.class); - Assertions.assertEquals(UUID.fromString("31f9d37f-ba99-4b53-b5f1-186a76a93523"), model.subscriptionId()); - Assertions.assertEquals("zyde", model.meterId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-18T09:45:02Z"), model.usageStartTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-10T11:45:10Z"), model.usageEndTime()); - Assertions.assertEquals(57.05146F, model.quantity()); - Assertions.assertEquals("xinpmqnjaq", model.unit()); - Assertions.assertEquals("xj", model.meterName()); - Assertions.assertEquals("r", model.meterCategory()); - Assertions.assertEquals("vcputegj", model.meterSubCategory()); - Assertions.assertEquals("mfdatscmdvpj", model.meterRegion()); - Assertions.assertEquals("suuv", model.infoFields().project()); - Assertions.assertEquals("jozkrwfndiod", model.instanceData()); - } -}