2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2018 Nokia.
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.flow.controller.ResponseHandlerImpl;
22 import static org.junit.Assert.assertEquals;
24 import java.util.Collections;
25 import org.junit.Test;
26 import org.onap.appc.flow.controller.data.ResponseAction;
27 import org.onap.appc.flow.controller.data.Transaction;
29 public class DefaultResponseHandlerTest {
32 public void handlerResponse_shouldReturnEmptyResponseAction_whenTransactionResponsesAreNull() {
33 Transaction transaction = new Transaction();
34 assertDefaultResponseAction(transaction);
38 public void handlerResponse_shouldReturnEmptyResponseAction_whenTransactionResponsesAreEmpty() {
39 Transaction transaction = new Transaction();
40 transaction.setResponses(Collections.emptyList());
41 assertDefaultResponseAction(transaction);
44 private void assertDefaultResponseAction(Transaction transaction) {
46 ResponseAction expectedResponseAction = new ResponseAction();
49 ResponseAction responseAction = new DefaultResponseHandler().handlerResponse(transaction);
52 assertEquals(expectedResponseAction.isIntermediateMessage(), responseAction.isIntermediateMessage());
53 assertEquals(expectedResponseAction.getJump(), responseAction.getJump());
54 assertEquals(expectedResponseAction.getRetry(), responseAction.getRetry());
55 assertEquals(expectedResponseAction.getWait(), responseAction.getWait());
56 assertEquals(expectedResponseAction.isIgnore(), responseAction.isIgnore());
57 assertEquals(expectedResponseAction.isStop(), responseAction.isStop());
58 assertEquals(expectedResponseAction.toString(), responseAction.toString());