use of org.wso2.carbon.apimgt.rest.api.store.dto.CompositeAPIDTO in project carbon-apimgt by wso2.
the class CompositeAPIMappingUtilTestCase method testToCompositeAPIDTOAndViceVersa.
@Test
public void testToCompositeAPIDTOAndViceVersa() {
List<String> labels = new ArrayList<>();
labels.add("label1");
// Test compositeAPI to CompositeAPIDTO
CompositeAPI compositeAPI = SampleTestObjectCreator.createCompositeAPIModelBuilder().labels(labels).build();
CompositeAPIDTO compositeAPIDTO = CompositeAPIMappingUtil.toCompositeAPIDTO(compositeAPI);
assertEquals(compositeAPI.getId(), compositeAPIDTO.getId());
assertEquals(compositeAPI.getName(), compositeAPIDTO.getName());
assertEquals(compositeAPI.getProvider(), compositeAPIDTO.getProvider());
assertEquals(compositeAPI.getVersion(), compositeAPIDTO.getVersion());
assertEquals(compositeAPI.getContext(), compositeAPIDTO.getContext());
assertEquals(compositeAPI.getDescription(), compositeAPIDTO.getDescription());
assertEquals(compositeAPI.getLabels().size(), compositeAPIDTO.getLabels().size());
assertEquals(compositeAPI.getApplicationId(), compositeAPIDTO.getApplicationId());
// Test CompositeAPIDTO to compositeAPI
CompositeAPI compositeAPIGenerated = CompositeAPIMappingUtil.toAPI(compositeAPIDTO).build();
assertEquals(compositeAPIGenerated.getId(), compositeAPIDTO.getId());
assertEquals(compositeAPIGenerated.getName(), compositeAPIDTO.getName());
assertEquals(compositeAPIGenerated.getProvider(), compositeAPIDTO.getProvider());
assertEquals(compositeAPIGenerated.getVersion(), compositeAPIDTO.getVersion());
assertEquals(compositeAPIGenerated.getContext(), compositeAPIDTO.getContext());
assertEquals(compositeAPIGenerated.getDescription(), compositeAPIDTO.getDescription());
assertEquals(compositeAPIGenerated.getLabels().size(), compositeAPIDTO.getLabels().size());
assertEquals(compositeAPIGenerated.getApplicationId(), compositeAPIDTO.getApplicationId());
}
Aggregations