Aharoni, Pavel (pa0916) | ca3cb01 | 2018-10-22 15:29:57 +0300 | [diff] [blame] | 1 | /*-
|
| 2 | * ============LICENSE_START=======================================================
|
| 3 | * OSAM
|
| 4 | * ================================================================================
|
| 5 | * Copyright (C) 2018 AT&T
|
| 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
|
| 10 | *
|
| 11 | * http://www.apache.org/licenses/LICENSE-2.0
|
| 12 | *
|
| 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 | */
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 | package org.onap.osam.aai.model;
|
| 24 |
|
| 25 | import java.io.IOException;
|
| 26 | import java.util.ArrayList;
|
| 27 |
|
| 28 | import com.fasterxml.jackson.databind.ObjectMapper;
|
| 29 | import org.junit.Before;
|
| 30 | import org.junit.Test;
|
| 31 |
|
| 32 | import static org.hamcrest.MatcherAssert.assertThat;
|
| 33 | import static org.hamcrest.core.StringContains.containsString;
|
| 34 | import static org.hamcrest.core.IsEqual.equalTo;
|
| 35 |
|
| 36 | public class AaiGetPnfResponseTest {
|
| 37 |
|
| 38 | private AaiGetPnfResponse aaiGetPnfResponse;
|
| 39 |
|
| 40 | @Before
|
| 41 | public void setUp(){
|
| 42 | aaiGetPnfResponse = new AaiGetPnfResponse();
|
| 43 | aaiGetPnfResponse.results = new ArrayList<>();
|
| 44 | aaiGetPnfResponse.setAdditionalProperty("key1", "value1");
|
| 45 | aaiGetPnfResponse.setAdditionalProperty("key2", "value2");
|
| 46 | }
|
| 47 |
|
| 48 | @Test
|
| 49 | public void shouldHaveValidGettersAndSetters() throws IOException {
|
| 50 | String result = new ObjectMapper().writeValueAsString(aaiGetPnfResponse);
|
| 51 | assertThat(result, containsString("key1"));
|
| 52 | assertThat(result, containsString("value2"));
|
| 53 | assertThat(result, containsString("key2"));
|
| 54 | assertThat(result, containsString("value2"));
|
| 55 | }
|
| 56 |
|
| 57 | @Test
|
| 58 | public void shouldHaveValidToString(){
|
| 59 | assertThat(aaiGetPnfResponse.toString(),
|
| 60 | equalTo("AaiGetPnfResponse{results=[], additionalProperties={key1=value1, key2=value2}}"));
|
| 61 | }
|
| 62 |
|
| 63 | }
|