Fix different sonar issues
[sdc.git] / common / onap-common-configuration-management / onap-configuration-management-core / src / test / java / org / onap / config / test / ConfigurationQueryTest.java
1 /*
2  * Copyright (C) 2019 Samsung. All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package org.onap.config.test;
18
19 import org.junit.Test;
20 import org.onap.config.type.ConfigurationQuery;
21
22 import static org.junit.Assert.assertEquals;
23 import static org.junit.Assert.assertTrue;
24
25 public class ConfigurationQueryTest {
26     private static String TENANT = "OPENECOMP";
27     private static String NAMESPACE = "tetsNamepspace";
28     private static String KEY = "testKey";
29
30     @Test
31     public void testConfigurationQueryBuild() {
32         // given
33         ConfigurationQuery configurationQuery = new ConfigurationQuery();
34
35         // when
36         configurationQuery = configurationQuery
37                 .externalLookup(true)
38                 .fallback(true)
39                 .latest(true)
40                 .nodeSpecific(true)
41                 .namespace(NAMESPACE)
42                 .tenant(TENANT)
43                 .key(KEY);
44
45         // then
46         assertEquals(TENANT.toUpperCase(), configurationQuery.getTenant());
47         assertEquals(NAMESPACE.toUpperCase(), configurationQuery.getNamespace());
48         assertEquals(KEY, configurationQuery.getKey());
49         assertTrue(configurationQuery.isExternalLookup());
50         assertTrue(configurationQuery.isFallback());
51         assertTrue(configurationQuery.isLatest());
52         assertTrue(configurationQuery.isNodeSpecific());
53     }
54 }