1 /*******************************************************************************
2 * ============LICENSE_START==================================================
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
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====================================================
20 * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22 ******************************************************************************/
23 package org.onap.dmaap.datarouter.provisioning.beans;
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;
31 import java.util.Date;
34 @RunWith(PowerMockRunner.class)
35 @SuppressStaticInitializationFor({"org.onap.dmaap.datarouter.provisioning.beans.Group"})
36 public class GroupTest {
40 public void Validate_Group_Created_With_Default_Contructor() {
42 Assert.assertEquals(group.getGroupid(), -1);
43 Assert.assertEquals(group.getName(), "");
47 public void Validate_Getters_And_Setters() {
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());
66 public void Validate_Equals() {
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");
78 group2.setAuthid("Auth");
79 group2.setClassification("Class");
80 group2.setLast_mod(date);
81 Assert.assertEquals(group, group2);