Merge "Fixed Sonar issues"
[dmaap/datarouter.git] / datarouter-prov / src / test / java / org / onap / dmaap / datarouter / provisioning / beans / GroupTest.java
1 /*******************************************************************************
2  * ============LICENSE_START==================================================
3  * * org.onap.dmaap
4  * * ===========================================================================
5  * * Copyright © 2017 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
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  * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
21  * *
22  ******************************************************************************/
23 package org.onap.dmaap.datarouter.provisioning.beans;
24
25 import org.junit.Assert;
26 import org.junit.Test;
27 import org.junit.runner.RunWith;
28 import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor;
29 import org.powermock.modules.junit4.PowerMockRunner;
30
31 import java.util.Date;
32
33
34 @RunWith(PowerMockRunner.class)
35 @SuppressStaticInitializationFor({"org.onap.dmaap.datarouter.provisioning.beans.Group"})
36 public class GroupTest {
37     private Group group;
38
39     @Test
40     public void Validate_Group_Created_With_Default_Contructor() {
41         group = new Group();
42         Assert.assertEquals(group.getGroupid(), -1);
43         Assert.assertEquals(group.getName(), "");
44     }
45
46     @Test
47     public void Validate_Getters_And_Setters() {
48         group = new Group();
49         group.setGroupid(1);
50         group.setAuthid("Auth");
51         group.setClassification("Class");
52         group.setDescription("Description");
53         Date date = new Date();
54         group.setLast_mod(date);
55         group.setMembers("Members");
56         group.setName("NewName");
57         Assert.assertEquals(1, group.getGroupid());
58         Assert.assertEquals("Auth", group.getAuthid());
59         Assert.assertEquals("Class", group.getClassification());
60         Assert.assertEquals("Description", group.getDescription());
61         Assert.assertEquals(date, group.getLast_mod());
62         Assert.assertEquals("Members", group.getMembers());
63     }
64
65     @Test
66     public void Validate_Equals() {
67         group = new Group();
68         group.setGroupid(1);
69         group.setAuthid("Auth");
70         group.setClassification("Class");
71         group.setDescription("Description");
72         Date date = new Date();
73         group.setLast_mod(date);
74         group.setMembers("Members");
75         group.setName("NewName");
76         Group group2 = new Group("NewName", "Description", "Members");
77         group2.setGroupid(1);
78         group2.setAuthid("Auth");
79         group2.setClassification("Class");
80         group2.setLast_mod(date);
81         Assert.assertEquals(group, group2);
82     }
83 }