2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
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=========================================================
19 * Modifications copyright (c) 2019 Nokia
20 * ================================================================================
22 package org.openecomp.sdc.be.info;
24 import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor;
25 import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
26 import static org.hamcrest.CoreMatchers.is;
27 import static org.hamcrest.MatcherAssert.assertThat;
29 import org.junit.Test;
31 public class OperationalEnvInfoTest {
33 private static final String ID = "ID";
34 private static final String NAME = "NAME";
35 private static final String STATUS = "STATUS";
36 private static final String TYPE = "TYPE";
37 private static final String VERSION = "VERSION";
38 private static final String TENANT = "TENANT";
39 private static final String WORKLOAD = "WORKLOAD";
40 private static final String TO_STRING_RESPONSE = "{\"operational-environment-id\":\"ID\",\"operational-environment-name\":\"NAME\",\"operational-environment-type\":\"TYPE\",\"operational-environment-status\":\"STATUS\",\"tenant-context\":\"TENANT\",\"workload-context\":\"WORKLOAD\",\"resource-version\":\"VERSION\",\"relationship-list\":null}";
43 public void shouldHaveValidGettersAndSetters() {
44 assertThat(OperationalEnvInfo.class, hasValidGettersAndSetters());
48 public void shouldHaveValidDefaultConstructor() {
49 assertThat(OperationalEnvInfo.class, hasValidBeanConstructor());
53 public void testToStringShouldReturnCorrectFormat() {
54 OperationalEnvInfo operationalEnvInfo = new OperationalEnvInfo();
55 operationalEnvInfo.setOperationalEnvId(ID);
56 operationalEnvInfo.setOperationalEnvName(NAME);
57 operationalEnvInfo.setOperationalEnvStatus(STATUS);
58 operationalEnvInfo.setOperationalEnvType(TYPE);
59 operationalEnvInfo.setResourceVersion(VERSION);
60 operationalEnvInfo.setTenantContext(TENANT);
61 operationalEnvInfo.setWorkloadContext(WORKLOAD);
62 assertThat(operationalEnvInfo.toString(), is(TO_STRING_RESPONSE));