2 * ============LICENSE_START==========================================
4 * ===================================================================
5 * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
6 * ===================================================================
8 * Unless otherwise specified, all software contained herein is licensed
9 * under the Apache License, Version 2.0 (the "License");
10 * you may not use this software except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
21 * Unless otherwise specified, all documentation contained herein is licensed
22 * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
23 * you may not use this documentation except in compliance with the License.
24 * You may obtain a copy of the License at
26 * https://creativecommons.org/licenses/by/4.0/
28 * Unless required by applicable law or agreed to in writing, documentation
29 * distributed under the License is distributed on an "AS IS" BASIS,
30 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31 * See the License for the specific language governing permissions and
32 * limitations under the License.
34 * ============LICENSE_END============================================
38 package org.onap.portalapp.portal.utils;
40 import java.util.ArrayList;
41 import java.util.Date;
42 import java.util.List;
44 import org.junit.Test;
45 import org.onap.portalapp.portal.domain.EPUser;
46 import org.onap.portalapp.portal.domain.EPUserAppRoles;
48 public class HashMapFromListTest {
50 private static final String TEST="test";
53 public void testHashMap() {
55 List<String> data=new ArrayList<>();
58 HashMapFromList<String> map=new HashMapFromList<>();
59 map.hashMap(data, TEST);
64 public void testHashMapUser() {
66 List<EPUser> data=new ArrayList<>();
67 data.add(buildUser());
69 HashMapFromList<EPUser> map=new HashMapFromList<>();
70 map.hashMap(data, "firstName");
75 public void testHashMapUserField() {
77 List<EPUserAppRoles> data=new ArrayList<>();
78 EPUserAppRoles role=new EPUserAppRoles();
83 HashMapFromList<EPUserAppRoles> map=new HashMapFromList<>();
84 map.hashMap(data, "appId");
89 public void testHashMapUserFieldException() {
91 List<EPUserAppRoles> data=new ArrayList<>();
92 EPUserAppRoles role=new EPUserAppRoles();
97 HashMapFromList<EPUserAppRoles> map=new HashMapFromList<>();
98 map.hashMap(data, "appId");
104 private EPUser buildUser() {
105 EPUser epUser = new EPUser();
107 epUser.setId((long)1);
108 epUser.setManagerId((long) 1234);
109 epUser.setFirstName(TEST);
110 epUser.setLastName(TEST);
111 epUser.setMiddleInitial(TEST);
112 epUser.setPhone(TEST);
114 epUser.setCellular(TEST);
115 epUser.setEmail(TEST);
116 epUser.setAddressId((long) 123);
117 epUser.setAlertMethodCd(TEST);
118 epUser.setHrid(TEST);
119 epUser.setOrgUserId(TEST);
120 epUser.setOrgCode(TEST);
121 epUser.setAddress1(TEST);
122 epUser.setAddress2(TEST);
123 epUser.setCity(TEST);
124 epUser.setState(TEST);
125 epUser.setZipCode(TEST);
126 epUser.setCountry(TEST);
127 epUser.setOrgManagerUserId(TEST);
128 epUser.setLocationClli(TEST);
129 epUser.setBusinessCountryCode(TEST);
130 epUser.setBusinessCountryName(TEST);
131 epUser.setBusinessUnit(TEST);
132 epUser.setBusinessUnitName(TEST);
133 epUser.setDepartment(TEST);
134 epUser.setDepartmentName(TEST);
135 epUser.setCompanyCode(TEST);
136 epUser.setCompany(TEST);
137 epUser.setZipCodeSuffix(TEST);
138 epUser.setJobTitle(TEST);
139 epUser.setCommandChain(TEST);
140 epUser.setSiloStatus(TEST);
141 epUser.setCostCenter(TEST);
142 epUser.setFinancialLocCode(TEST);
143 epUser.setLoginId(TEST);
144 epUser.setLoginPwd(TEST);
145 epUser.setLastLoginDate(new Date());
146 epUser.setActive(false);
147 epUser.setInternal(false);
148 epUser.setSelectedProfileId((long) 12345);
149 epUser.setTimeZoneId((long) 12345);
150 epUser.setOnline(false);
151 epUser.setChatId(TEST);