2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2021 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=========================================================
21 package org.onap.so.client.oof;
23 import java.util.Collections;
24 import java.util.HashMap;
25 import java.util.LinkedHashMap;
27 import org.junit.Test;
28 import org.onap.so.client.exception.BadResponseException;
30 public class OofValidatorTest {
33 public void validateDemandsResponse_success() throws Exception {
34 Map<String, String> map = new LinkedHashMap<>();
35 map.put("requestStatus", "accepted");
36 new OofValidator().validateDemandsResponse(map);
39 @Test(expected = BadResponseException.class)
40 public void validateDemandsResponse_mapIsEmpty() throws Exception {
41 new OofValidator().validateDemandsResponse(Collections.emptyMap());
44 @Test(expected = BadResponseException.class)
45 public void validateDemandsResponse_lackOfRequestStatus() throws Exception {
46 Map<String, String> map = new LinkedHashMap<>();
48 new OofValidator().validateDemandsResponse(map);
51 @Test(expected = BadResponseException.class)
52 public void validateDemandsResponse_lackOfRequestStatusProperValue() throws Exception {
53 Map<String, String> map = new HashMap<>();
54 map.put("requestStatus", "a");
55 map.put("statusMessage", "a");
56 new OofValidator().validateDemandsResponse(map);