2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
6 * Modifications Copyright (C) 2019 Nordix Foundation.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.policy.rest.jpa;
24 import static org.hamcrest.CoreMatchers.is;
25 import static org.hamcrest.CoreMatchers.not;
26 import static org.junit.Assert.assertEquals;
27 import static org.junit.Assert.assertNull;
28 import static org.junit.Assert.assertThat;
30 import java.util.Date;
32 import org.junit.Test;
34 public class ConfigurationDataEntityTest {
36 public void testEquals() {
38 String value = "testVal";
39 ConfigurationDataEntity entity = new ConfigurationDataEntity();
41 ConfigurationDataEntity entity3 = new ConfigurationDataEntity();
45 entity3.setConfigBody(value);
46 assertEquals(value, entity3.getConfigBody());
47 entity3.setCreatedBy(value);
48 assertEquals(value, entity3.getCreatedBy());
49 entity3.setModifiedBy(value);
50 assertEquals(value, entity3.getModifiedBy());
52 Date date = new Date();
53 entity3.setModifiedDate(date);
54 assertEquals(date, entity3.getModifiedDate());
55 assertEquals(0, entity3.getVersion());
56 assertNull(entity3.getCreatedDate());
57 entity3.setDeleted(true);
58 assertEquals(true, entity3.isDeleted());
59 entity3.setDescription(value);
60 assertEquals(value, entity3.getDescription());
61 entity3.setConfigType(value);
62 assertEquals(value, entity3.getConfigType());
63 entity3.setConfigurationName(value);
64 assertEquals(value, entity3.getConfigurationName());
65 assertEquals(0, entity3.getConfigurationDataId());
67 // Test method combinations
68 assertEquals(false, entity.equals(null));
69 assertEquals(true, entity.equals(entity));
70 assertEquals(false, entity.equals(value));
72 ConfigurationDataEntity entity2 = new ConfigurationDataEntity();
73 assertEquals(false, entity.equals(entity2));
74 assertThat(entity.hashCode(), is(not(0)));