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 ActionBodyEntityTest {
36 public void testEntity() {
38 String value = "testVal";
39 ActionBodyEntity entity = new ActionBodyEntity();
43 ActionBodyEntity entity0 = new ActionBodyEntity();
45 entity0.setActionBody(value);
46 assertEquals(value, entity0.getActionBody());
47 entity0.setActionBodyName(value);
48 assertEquals(value, entity0.getActionBodyName());
49 entity0.setCreatedBy(value);
50 assertEquals(value, entity0.getCreatedBy());
51 entity0.setModifiedBy(value);
52 assertEquals(value, entity0.getModifiedBy());
54 Date date = new Date();
55 entity0.setModifiedDate(date);
56 assertEquals(date, entity0.getModifiedDate());
57 assertEquals(0, entity0.getVersion());
58 assertNull(entity0.getCreatedDate());
59 entity0.setDeleted(true);
60 assertEquals(true, entity0.isDeleted());
61 assertEquals(0, entity0.getActionBodyId());
63 // Test equals method combinations
64 assertEquals(false, entity.equals(null));
65 assertEquals(true, entity.equals(entity));
66 assertEquals(false, entity.equals((Object) value));
67 ActionBodyEntity entity1 = new ActionBodyEntity();
68 assertEquals(false, entity.equals(entity1));
69 assertThat(entity.hashCode(), is(not(0)));