1 /*******************************************************************************
3 * * ===========================================================================
4 * * Copyright © 2023 AT&T Intellectual Property. All rights reserved.
5 * * ===========================================================================
6 * * Licensed under the Apache License, Version 2.0 (the "License");
7 * * you may not use this file except in compliance with the License.
8 * * You may obtain a copy of the License at
10 * * http://www.apache.org/licenses/LICENSE-2.0
12 * * Unless required by applicable law or agreed to in writing, software
13 * * distributed under the License is distributed on an "AS IS" BASIS,
14 * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * * See the License for the specific language governing permissions and
16 * * limitations under the License.
17 * * ============LICENSE_END====================================================
20 ******************************************************************************/
22 package org.onap.ccsdk.apps.cadi.config.test;
24 import static org.junit.Assert.*;
25 import static org.hamcrest.CoreMatchers.*;
28 import java.io.ByteArrayOutputStream;
29 import java.io.IOException;
30 import java.io.PrintStream;
32 import org.onap.ccsdk.apps.cadi.PropAccess;
33 import org.onap.ccsdk.apps.cadi.config.Get;
34 import org.onap.ccsdk.apps.cadi.config.MultiGet;
36 public class JU_MultiGet {
38 private String defaultVal = "some default value";
40 private ByteArrayOutputStream outStream;
42 private MultiGet multiGet;
43 private Get.AccessGet accessGet;
44 private PropAccess access;
47 public void setup() throws IOException {
48 outStream = new ByteArrayOutputStream();
49 System.setOut(new PrintStream(outStream));
51 access = new PropAccess();
52 access.setProperty("tag", "value");
53 accessGet = new Get.AccessGet(access);
54 multiGet = new MultiGet(accessGet, Get.NULL);
58 public void tearDown() {
59 System.setOut(System.out);
63 public void getTest() {
64 assertThat(multiGet.get("tag", defaultVal, false), is("value"));
65 assertThat(multiGet.get("not_a_tag", defaultVal, false), is(defaultVal));