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=========================================================
21 package org.onap.policy.rest.jpa;
23 import static org.hamcrest.CoreMatchers.is;
24 import static org.hamcrest.CoreMatchers.not;
25 import static org.junit.Assert.assertEquals;
26 import static org.junit.Assert.assertNull;
27 import static org.junit.Assert.assertThat;
28 import java.util.Date;
29 import org.junit.Test;
31 public class ConfigurationDataEntityTest {
33 public void testEquals() {
35 String value = "testVal";
36 Date date = new Date();
37 ConfigurationDataEntity entity = new ConfigurationDataEntity();
39 ConfigurationDataEntity entity2 = new ConfigurationDataEntity();
40 ConfigurationDataEntity entity3 = new ConfigurationDataEntity();
44 entity3.setConfigBody(value);
45 assertEquals(value, entity3.getConfigBody());
46 entity3.setCreatedBy(value);
47 assertEquals(value, entity3.getCreatedBy());
48 entity3.setModifiedBy(value);
49 assertEquals(value, entity3.getModifiedBy());
50 entity3.setModifiedDate(date);
51 assertEquals(date, entity3.getModifiedDate());
52 assertEquals(0, entity3.getVersion());
53 assertNull(entity3.getCreatedDate());
54 entity3.setDeleted(true);
55 assertEquals(true, entity3.isDeleted());
56 entity3.setDescription(value);
57 assertEquals(value, entity3.getDescription());
58 entity3.setConfigType(value);
59 assertEquals(value, entity3.getConfigType());
60 entity3.setConfigurationName(value);
61 assertEquals(value, entity3.getConfigurationName());
62 assertEquals(0, entity3.getConfigurationDataId());
64 // Test method combinations
65 assertEquals(false, entity.equals(null));
66 assertEquals(true, entity.equals(entity));
67 assertEquals(false, entity.equals(value));
68 assertEquals(false, entity.equals(entity2));
69 assertThat(entity.hashCode(), is(not(0)));