2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright 2018 TechMahindra
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=========================================================
20 package org.onap.appc.domainmodel.lcm;
22 import static org.junit.Assert.*;
23 import org.junit.Assert;
24 import org.junit.Before;
25 import org.junit.Test;
27 public class TestTransactionRecord {
29 private TransactionRecord transactionRecord;
33 transactionRecord = new TransactionRecord();
37 public void testGetTransactionId() {
38 transactionRecord.setTransactionId("1234");
39 Assert.assertNotNull(transactionRecord.getTransactionId());
40 Assert.assertEquals(transactionRecord.getTransactionId(), "1234");
44 public void testGetRequestId() {
45 transactionRecord.setRequestId("1298ABC");
46 Assert.assertNotNull(transactionRecord.getRequestId());
47 Assert.assertEquals(transactionRecord.getRequestId(), "1298ABC");
51 public void testGetSubRequestId() {
52 transactionRecord.setSubRequestId("1298");
53 Assert.assertNotNull(transactionRecord.getSubRequestId());
54 Assert.assertEquals(transactionRecord.getSubRequestId(), "1298");
58 public void testGetOriginatorId() {
59 transactionRecord.setOriginatorId("1111");
60 Assert.assertNotNull(transactionRecord.getOriginatorId());
61 Assert.assertEquals(transactionRecord.getOriginatorId(), "1111");
65 public void testGetTargetId() {
66 transactionRecord.setTargetId("2222");
67 Assert.assertNotNull(transactionRecord.getTargetId());
68 Assert.assertEquals(transactionRecord.getTargetId(), "2222");
72 public void testGetTargetType() {
73 transactionRecord.setTargetType("A");
74 Assert.assertNotNull(transactionRecord.getTargetType());
75 Assert.assertEquals(transactionRecord.getTargetType(), "A");
79 public void testGetResultCode() {
80 transactionRecord.setResultCode(200);
81 Assert.assertNotNull(transactionRecord.getResultCode());
82 Assert.assertEquals(transactionRecord.getResultCode(), 200);
86 public void testGetDescription() {
87 transactionRecord.setDescription("SUCCESS");
88 Assert.assertNotNull(transactionRecord.getDescription());
89 Assert.assertEquals(transactionRecord.getDescription(), "SUCCESS");
93 public void testGetServiceInstanceId() {
94 transactionRecord.setServiceInstanceId("A1");
95 Assert.assertNotNull(transactionRecord.getServiceInstanceId());
96 Assert.assertEquals(transactionRecord.getServiceInstanceId(), "A1");
100 public void testGetVnfcName() {
101 transactionRecord.setVnfcName("Vnf1");
102 Assert.assertNotNull(transactionRecord.getVnfcName());
103 Assert.assertEquals(transactionRecord.getVnfcName(), "Vnf1");
107 public void testGetVserverId() {
108 transactionRecord.setVserverId("V1");
109 Assert.assertNotNull(transactionRecord.getVserverId());
110 Assert.assertEquals(transactionRecord.getVserverId(), "V1");
114 public void testGetVfModuleId() {
115 transactionRecord.setVfModuleId("M1");
116 Assert.assertNotNull(transactionRecord.getVfModuleId());
117 Assert.assertEquals(transactionRecord.getVfModuleId(), "M1");
121 public void testToString_ReturnNonEmptyString() {
122 assertNotEquals(transactionRecord.toString(), "");
123 assertNotEquals(transactionRecord.toString(), null);
127 public void testToString_ContainsString() {
128 assertTrue(transactionRecord.toString().contains("TransactionRecord{transactionId"));