8a173b452ab49e9237b9d96139e934d12f71a560
[sdc.git] /
1 /*
2  * Copyright © 2016-2018 European Support Limited
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.openecomp.sdc.logging.api;
18
19 import static org.testng.Assert.assertEquals;
20 import static org.testng.Assert.assertNull;
21
22 import org.testng.annotations.Test;
23
24 /**
25  * Unit-testing context data builder.
26  *
27  * @author evitaliy
28  * @since 04 Mar 18
29  */
30 public class ContextDataTest {
31
32     @Test
33     public void allPropertiesReadWhenPopulated() {
34
35         final String serviceName = "running-service";
36         final String partnerName = "remote-partner";
37         final String requestId = "123412341234";
38
39         ContextData data = ContextData.builder()
40             .serviceName(serviceName).partnerName(partnerName).requestId(requestId).build();
41
42         assertEquals(data.getRequestId(), requestId);
43         assertEquals(data.getServiceName(), serviceName);
44         assertEquals(data.getPartnerName(), partnerName);
45     }
46
47     @Test
48     public void allPropertiesEmptyWhenUnpopulated() {
49         ContextData data = ContextData.builder().build();
50         assertNull(data.getRequestId());
51         assertNull(data.getServiceName());
52         assertNull(data.getPartnerName());
53     }
54 }