2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
19 * Modifications copyright (c) 2019 Nokia
20 * ================================================================================
22 package org.openecomp.sdc.fe.impl;
24 import static org.junit.Assert.assertEquals;
26 import org.junit.Test;
28 public class MdcDataTest {
30 private static final String INSTANCE_ID = "INSTANCE_ID";
31 private static final String USER_ID = "USER_ID";
32 private static final String REMOTE_ADDRESS = "REMOTE_ADDRESS";
33 private static final String LOCAL_ADDRESS = "LOCAL_ADDRESS";
34 private static final long TRANSACTION_START_TIME = 123L;
37 public void testGetTransactionStartTimeIsSetByConstructor() {
38 MdcData testSubject = createTestSubject();
39 assertEquals(testSubject.getTransactionStartTime(), Long.valueOf(TRANSACTION_START_TIME));
43 public void testGetUserIdIsSetByConstructor() {
44 MdcData testSubject = createTestSubject();
45 assertEquals(testSubject.getUserId(), USER_ID);
49 public void testGetRemoteAddrIsSetByConstructor() {
50 MdcData testSubject = createTestSubject();
51 assertEquals(testSubject.getRemoteAddr(), REMOTE_ADDRESS);
55 public void testGetLocalAddrIsSetByConstructor() {
56 MdcData testSubject = createTestSubject();
57 assertEquals(testSubject.getLocalAddr(), LOCAL_ADDRESS);
61 public void testGetServiceInstanceIDIsSetByConstructor(){
62 MdcData testSubject = createTestSubject();
63 assertEquals(testSubject.getServiceInstanceID(), INSTANCE_ID);
66 private MdcData createTestSubject() {
67 return new MdcData(INSTANCE_ID, USER_ID, REMOTE_ADDRESS, LOCAL_ADDRESS, TRANSACTION_START_TIME);