Mass removal of all Tabs (Style Warnings)
[aaf/authz.git] / cadi / core / src / test / java / org / onap / aaf / cadi / config / test / JU_MultiGet.java
1 /*******************************************************************************
2  * * org.onap.aaf
3  * * ===========================================================================
4  * * Copyright © 2017 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
9  * *
10  *  *      http://www.apache.org/licenses/LICENSE-2.0
11  * *
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====================================================
18  * *
19  * *
20  ******************************************************************************/
21
22 package org.onap.aaf.cadi.config.test;
23
24 import static org.junit.Assert.*;
25 import static org.hamcrest.CoreMatchers.*;
26 import org.junit.*;
27
28 import java.io.ByteArrayOutputStream;
29 import java.io.IOException;
30 import java.io.PrintStream;
31
32 import org.onap.aaf.cadi.PropAccess;
33 import org.onap.aaf.cadi.config.Get;
34 import org.onap.aaf.cadi.config.MultiGet;
35
36 public class JU_MultiGet {
37
38     private String defaultVal = "some default value";
39
40     private ByteArrayOutputStream outStream;
41
42     private MultiGet multiGet;
43     private Get.AccessGet accessGet;
44     private PropAccess access;
45
46     @Before
47     public void setup() throws IOException {
48         outStream = new ByteArrayOutputStream();
49         System.setOut(new PrintStream(outStream));
50
51         access = new PropAccess();
52         access.setProperty("tag", "value");
53         accessGet = new Get.AccessGet(access);
54         multiGet = new MultiGet(accessGet, Get.NULL);
55     }
56
57     @After
58     public void tearDown() {
59         System.setOut(System.out);
60     }
61
62     @Test
63     public void getTest() {
64         assertThat(multiGet.get("tag", defaultVal, false), is("value"));
65         assertThat(multiGet.get("not_a_tag", defaultVal, false), is(defaultVal));
66     }
67
68 }