2 * ============LICENSE_START===================================================
3 * Copyright (c) 2018 Amdocs
4 * ============================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 * ============LICENSE_END=====================================================
18 package org.onap.aai.validation.modeldriven.configuration.mapping;
20 import static org.hamcrest.Matchers.is;
21 import static org.junit.Assert.assertThat;
22 import static org.junit.Assert.assertTrue;
24 import java.util.ArrayList;
25 import java.util.List;
26 import org.junit.Test;
27 import org.onap.aai.validation.modeldriven.configuration.mapping.Filter;
28 import org.onap.aai.validation.modeldriven.configuration.mapping.ModelInstanceMapper;
29 import org.onap.aai.validation.modeldriven.configuration.mapping.ValueConfiguration;
30 import org.onap.aai.validation.modeldriven.configuration.mapping.ModelInstanceMapper.MappingType;
32 public class TestModelInstanceMapper {
35 System.setProperty("APP_HOME", ".");
39 public void testAllMethodsToImproveCodeCoverage() {
40 List<String> valid = new ArrayList<>();
42 Filter filter = new Filter();
43 filter.setPath("testPath");
44 filter.setValid(valid);
46 ValueConfiguration valueConf1 = new ValueConfiguration();
47 valueConf1.setFilter(filter);
48 valueConf1.setId("id");
49 valueConf1.setOrigin("testOrigin");
50 valueConf1.setRoot("testRoot");
51 valueConf1.setValue("testValue");
53 ModelInstanceMapper mapper1 = new ModelInstanceMapper();
54 mapper1.setInstance(valueConf1);
55 mapper1.setMappingType(MappingType.ATTRIBUTE.toString());
56 mapper1.setModel(valueConf1);
58 ModelInstanceMapper mapper2 = new ModelInstanceMapper();
59 mapper2.setInstance(valueConf1);
60 mapper2.setMappingType(MappingType.ATTRIBUTE.toString());
61 mapper2.setModel(valueConf1);
63 assertThat(mapper1.hashCode(), is(mapper2.hashCode()));
64 assertThat(mapper1.getInstance(), is(mapper2.getInstance()));
65 assertThat(mapper1.getMappingType(), is(mapper2.getMappingType()));
66 assertThat(mapper1.getModel(), is(mapper2.getModel()));
67 assertThat(mapper1.toString(), is(mapper2.toString()));
68 assertTrue(mapper1.equals(mapper2));