2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2021, Nordix Foundation. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
20 package org.openecomp.sdc.be.tosca.utils;
22 import static org.assertj.core.api.Assertions.assertThat;
23 import static org.mockito.ArgumentMatchers.any;
24 import static org.mockito.Mockito.doReturn;
26 import java.util.ArrayList;
27 import java.util.HashMap;
28 import java.util.List;
30 import org.junit.jupiter.api.Test;
31 import org.junit.jupiter.api.extension.ExtendWith;
32 import org.mockito.InjectMocks;
33 import org.mockito.Mock;
34 import org.mockito.junit.jupiter.MockitoExtension;
35 import org.openecomp.sdc.be.model.OutputDefinition;
36 import org.openecomp.sdc.be.tosca.AttributeConverter;
37 import org.openecomp.sdc.be.tosca.exception.ToscaConversionException;
38 import org.openecomp.sdc.be.tosca.model.ToscaProperty;
39 import org.springframework.beans.factory.ObjectProvider;
41 @ExtendWith(MockitoExtension.class)
42 class OutputConverterTest {
45 private OutputConverter testSubject;
48 private ObjectProvider<AttributeConverter> attributeConverterProvider;
51 void test_convert_success() throws ToscaConversionException {
52 final List<OutputDefinition> outputDefinitionList = new ArrayList<>();
53 final OutputDefinition outputDefinition = new OutputDefinition();
54 outputDefinitionList.add(outputDefinition);
56 doReturn(new AttributeConverter(new HashMap<>())).when(attributeConverterProvider).getObject(any());
57 final Map<String, ToscaProperty> result = testSubject.convert(outputDefinitionList, new HashMap<>());
58 assertThat(result).isNotNull();
62 void test_convert_isEmpty() throws ToscaConversionException {
63 final Map<String, ToscaProperty> result = testSubject.convert(new ArrayList<>(), new HashMap<>());
64 assertThat(result).isNotNull().isEmpty();