From 91f0a9df3d688f3a7508c9088c8410872e22428e Mon Sep 17 00:00:00 2001 From: vempo Date: Sat, 17 Nov 2018 21:10:53 +0200 Subject: Unit-tests for mappers in VSP library Change-Id: Ibbe2e9c4ee85a7fe77b2b68e21d2266010f4fa62 Issue-ID: SDC-1917 Signed-off-by: vempo --- .../vsp/rest/mapping/MapVspDetailsToDtoTest.java | 87 ++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDetailsToDtoTest.java (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDetailsToDtoTest.java') diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDetailsToDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDetailsToDtoTest.java new file mode 100644 index 0000000000..d5eb7be0d3 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDetailsToDtoTest.java @@ -0,0 +1,87 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openecomp.sdcrests.vsp.rest.mapping; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; +import org.openecomp.sdc.vendorsoftwareproduct.types.LicensingData; +import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspDetailsDto; + +/** + * This class was generated. + */ +public class MapVspDetailsToDtoTest { + + @Test() + public void testConversion() { + + final VspDetails source = new VspDetails(); + + final String id = "072b88a8-0b34-4e3e-a0be-1f664100f76c"; + source.setId(id); + + final String versionId = "345-96f20205613f"; + final Version version = new Version(versionId); + source.setVersion(version); + + final String name = "cd60b1d0-cf2f-48b4-b578-96f20205613f"; + source.setName(name); + + final String description = "3baf3188-c7b4-48a2-9b4d-0258216ce4b5"; + source.setDescription(description); + + final String category = "d05d10e3-35d6-45aa-83a5-f41194468fc2"; + source.setCategory(category); + + final String subCategory = "9a4652df-ff91-4817-bfa0-ded9fd57012e"; + source.setSubCategory(subCategory); + + final String icon = "2ee3b647-f3f0-4c85-9134-b4e960246b06"; + source.setIcon(icon); + + final String vendorName = "e9351739-6a2b-4214-b386-e71dc48ff97d"; + source.setVendorName(vendorName); + + final String vendorId = "b2f67f43-3b19-4037-a982-ed7bc2ed8d68"; + source.setVendorId(vendorId); + + final String vlmVersionId = "3b194037a982ed7b"; + source.setVlmVersion(new Version(vlmVersionId)); + + final String onboardingMethod = "b46520ac-e62f-4a24-8f40-ee6e65889bfc"; + source.setOnboardingMethod(onboardingMethod); + + final VspDetailsDto target = new VspDetailsDto(); + final MapVspDetailsToDto mapper = new MapVspDetailsToDto(); + mapper.doMapping(source, target); + + assertEquals(id, source.getId()); + assertEquals(versionId, target.getVersion()); + assertEquals(name, target.getName()); + assertEquals(description, target.getDescription()); + assertEquals(icon, target.getIcon()); + assertEquals(category, target.getCategory()); + assertEquals(subCategory, target.getSubCategory()); + assertEquals(vendorId, target.getVendorId()); + assertEquals(vendorName, target.getVendorName()); + assertEquals(vlmVersionId, target.getLicensingVersion()); + assertEquals(onboardingMethod, target.getOnboardingMethod()); + } +} -- cgit 1.2.3-korg