2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 IBM.
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.
19 * ============LICENSE_END=========================================================
21 package org.onap.appc.seqgen.objects;
23 import static org.mockito.Mockito.mock;
24 import static org.junit.Assert.assertEquals;
25 import java.util.ArrayList;
26 import org.junit.Assert;
27 import org.junit.Before;
28 import org.junit.Test;
30 import java.util.HashMap;
32 public class TransactionTest {
34 private Transaction transaction;
38 transaction = new Transaction();
42 public void get_set_transaction_id() {
44 transaction.setTransactionId(id);
45 assertEquals(id, transaction.getTransactionId());
49 public void get_set_action() {
50 String action = "some_action";
51 transaction.setAction(action);
52 assertEquals(action, transaction.getAction());
56 public void get_set_action_level() {
57 String actionLevel = "some_action_level";
58 transaction.setActionLevel(actionLevel);
59 assertEquals(actionLevel, transaction.getActionLevel());
63 public void get_set_action_identifier() {
64 ActionIdentifier actionIdentifier = mock(ActionIdentifier.class);
65 transaction.setActionIdentifier(actionIdentifier);
66 assertEquals(actionIdentifier, transaction.getActionIdentifier());
70 public void get_set_payload() {
71 String payload = "some_payload";
72 transaction.setPayload(payload);
73 assertEquals(payload, transaction.getPayload());
77 public void get_setPreCheckOperator() {
78 String preCheckOperator = "some_preCheckOperator";
79 transaction.setPreCheckOperator(preCheckOperator);
80 assertEquals(preCheckOperator, transaction.getPreCheckOperator());
84 public void get_set_responses() {
85 ArrayList<Response> responses = new ArrayList<>();
86 responses.add(mock(Response.class));
87 transaction.setResponses(responses);
88 assertEquals(responses, transaction.getResponses());
92 public void get_set_precheckOptions() {
93 ArrayList<PreCheckOption> precheckOptions = new ArrayList<>();
94 precheckOptions.add(mock(PreCheckOption.class));
95 transaction.setPrecheckOptions(precheckOptions);
96 assertEquals(precheckOptions, transaction.getPrecheckOptions());
99 public void get_set_parameters() {
100 Map<String, String> parameters = new HashMap<>();
101 parameters.put("hello","world");
102 transaction.setParameters(parameters);
103 assertEquals(parameters, transaction.getParameters());