summaryrefslogtreecommitdiffstats
path: root/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/AppsListWithAdminRoleTest.java
blob: 2c601d3c8b7c04158f6c1a426c3f5498ea150320 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package org.openecomp.portalapp.portal.transport;

import static org.junit.Assert.*;

import java.util.ArrayList;

import org.junit.Test;
import org.openecomp.portalapp.portal.transport.AppNameIdIsAdmin;
import org.openecomp.portalapp.portal.transport.AppsListWithAdminRole;

public class AppsListWithAdminRoleTest {
	
	public AppsListWithAdminRole mockAppsListWithAdminRole(){
		AppsListWithAdminRole appsListWithAdminRole = new AppsListWithAdminRole();
		
		ArrayList<AppNameIdIsAdmin> appsRoles = new ArrayList<AppNameIdIsAdmin>();
		AppNameIdIsAdmin appNameIdIsAdmin = new AppNameIdIsAdmin();
		appsRoles.add(appNameIdIsAdmin);
		
		appsListWithAdminRole.setOrgUserId("test");
		appsListWithAdminRole.setAppsRoles(appsRoles);
		
		return appsListWithAdminRole;
	}

	@Test
	public void appsListWithAdminRoleTest(){
		AppsListWithAdminRole appsListWithAdminRole = mockAppsListWithAdminRole();
		
		AppsListWithAdminRole appsListWithAdminRole1 = new AppsListWithAdminRole();
		
		ArrayList<AppNameIdIsAdmin> appsRoles = new ArrayList<AppNameIdIsAdmin>();
		AppNameIdIsAdmin appNameIdIsAdmin = new AppNameIdIsAdmin();
		appsRoles.add(appNameIdIsAdmin);
		
		appsListWithAdminRole1.setOrgUserId("test");
		appsListWithAdminRole1.setAppsRoles(appsRoles);
				
		assertEquals(appsListWithAdminRole.getOrgUserId(), "test");
		assertEquals(appsListWithAdminRole.getAppsRoles(), appsRoles);
		
		assertTrue(appsListWithAdminRole.equals(appsListWithAdminRole1));
		assertEquals(appsListWithAdminRole.hashCode(), appsListWithAdminRole1.hashCode());
		assertEquals(appsListWithAdminRole.toString(), "AppsListWithAdminRole [orgUserId=test, appsRoles=[AppNameIdIsAdmin [id=null, appName=null, isAdmin=null, restrictedApp=null]]]");
	}
}