Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mytime
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Narendar Vakiti
mytime
Commits
a54c15af
Commit
a54c15af
authored
Aug 30, 2018
by
Rajashekar jadala
Committed by
rbonthala-nisum-com
Aug 30, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
JUnit test cases (#168)
parent
254a5363
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
448 additions
and
381 deletions
+448
-381
UserControllerTest.java
...a/com/nisum/mytime/controllertest/UserControllerTest.java
+448
-381
No files found.
src/test/java/com/nisum/mytime/controllertest/UserControllerTest.java
View file @
a54c15af
...
...
@@ -2,6 +2,7 @@ package com.nisum.mytime.controllertest;
import
static
org
.
hamcrest
.
CoreMatchers
.
is
;
import
static
org
.
mockito
.
Matchers
.
anyObject
;
import
static
org
.
mockito
.
Mockito
.
atLeastOnce
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
when
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
request
.
MockMvcRequestBuilders
.
delete
;
...
...
@@ -12,7 +13,9 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
org.bson.types.ObjectId
;
import
org.junit.Before
;
...
...
@@ -29,259 +32,263 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import
com.nisum.mytime.controller.UserController
;
import
com.nisum.mytime.model.Account
;
import
com.nisum.mytime.model.Designation
;
import
com.nisum.mytime.model.Domains
;
import
com.nisum.mytime.model.EmployeeLocationDetails
;
import
com.nisum.mytime.model.EmployeeRoles
;
import
com.nisum.mytime.model.Location
;
import
com.nisum.mytime.model.MasterData
;
import
com.nisum.mytime.model.Shift
;
import
com.nisum.mytime.model.Skill
;
import
com.nisum.mytime.service.RoleMappingService
;
import
com.nisum.mytime.service.UserService
;
public
class
UserControllerTest
{
@Mock
UserService
userService
;
@InjectMocks
UserController
userController
;
private
MockMvc
mockMvc
;
@Before
public
void
setup
()
{
MockitoAnnotations
.
initMocks
(
this
);
mockMvc
=
MockMvcBuilders
.
standaloneSetup
(
userController
).
build
();
}
@Test
public
void
testgetEmployeeRole
()
throws
Exception
{
EmployeeRoles
employeesRole
=
new
EmployeeRoles
(
"5976ef15874c902c98b8a05d"
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
"user@nisum.com"
,
null
,
null
,
null
,
new
Date
(
2017
-
11
-
20
),
new
Date
(
2107
-
12
-
23
)
,
null
,
null
,
null
,
null
,
new
Date
(
2020
-
01
-
01
),
new
Date
(
2018
-
01
-
01
),
new
Date
(
2018
-
02
-
15
),
new
Date
(
2018
-
02
-
15
),
"Mahesh"
,
"Mahesh"
);
;
when
(
userService
.
getEmployeesRole
(
"mdeekonda@nisum.com"
))
.
thenReturn
(
employeesRole
)
;
mockMvc
.
perform
(
get
(
"/user/employee"
).
param
(
"emailId"
,
"mdeekonda@nisum.com"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
getEmployeesRole
(
"mdeekonda@nisum.com"
);
}
@Test
public
void
testassigingEmployeeRole
()
throws
Exception
{
EmployeeRoles
employeeRole
=
new
EmployeeRoles
(
"5976ef15874c902c98b8a05d"
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
"user@nisum.com"
,
null
,
null
,
null
,
new
Date
(
2017
-
11
-
20
),
new
Date
(
2107
-
12
-
23
),
null
,
null
,
null
,
null
,
new
Date
(
2020
-
01
-
01
),
new
Date
(
2018
-
01
-
01
),
new
Date
(
2018
-
02
-
15
),
new
Date
(
2018
-
02
-
15
),
"Mahesh"
,
"Mahesh"
);
ObjectMapper
mapper
=
new
ObjectMapper
(
);
String
jsonString
=
mapper
.
writeValueAsString
(
employeeRole
);
when
(
userService
.
assigingEmployeeRole
(
anyObject
(),
anyObject
()))
.
thenReturn
(
employeeRole
);
mockMvc
.
perform
(
post
(
"/user/assignEmployeeRole"
).
param
(
"empId"
,
"16999"
)
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)
.
content
(
jsonString
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
assigingEmployeeRole
(
anyObject
(),
anyObject
());
}
@Test
public
void
testupdateEmployeeRole
()
throws
Exception
{
EmployeeRoles
employeeRole2
=
new
EmployeeRoles
(
"5976ef15874c902c98b8a05d"
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
"user@nisum.com"
,
null
,
null
,
null
,
new
Date
(
2017
-
11
-
20
),
new
Date
(
2107
-
12
-
23
),
null
,
null
,
null
,
null
,
new
Date
(
2020
-
01
-
01
),
new
Date
(
2018
-
01
-
01
),
new
Date
(
2018
-
02
-
15
),
new
Date
(
2018
-
02
-
15
),
"Mahesh"
,
"Mahesh"
);
ObjectMapper
mapper
=
new
ObjectMapper
(
);
String
jsonString
=
mapper
.
writeValueAsString
(
employeeRole2
);
when
(
userService
.
updateEmployeeRole
(
anyObject
(),
anyObject
()))
.
thenReturn
(
employeeRole2
);
mockMvc
.
perform
(
post
(
"/user/updateEmployeeRole"
).
param
(
"empId"
,
"16999"
)
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)
.
content
(
jsonString
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
updateEmployeeRole
(
anyObject
(),
anyObject
()
);
}
@Test
public
void
testdeleteEmployee
()
throws
Exception
{
mockMvc
.
perform
(
delete
(
"/user/deleteEmployee"
).
param
(
"empId"
,
"16127"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
deleteEmployee
(
"16127"
);
}
@Test
public
void
testgetUserRoles
()
throws
Exception
{
List
<
EmployeeRoles
>
employeesRole3
=
CreateUserRoles
();
when
(
userService
.
getEmployeeRoles
()).
thenReturn
(
employeesRole3
);
mockMvc
.
perform
(
get
(
"/user/getUserRoles"
)
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
getEmployeeRoles
();
}
@Test
public
void
testgetEmployeeRoleData
()
throws
Exception
{
EmployeeRoles
employeesRole
=
new
EmployeeRoles
(
"5976ef15874c902c98b8a05d"
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
"user@nisum.com"
,
null
,
null
,
null
,
new
Date
(
2017
-
11
-
20
),
new
Date
(
2107
-
12
-
23
),
null
,
null
,
null
,
null
,
new
Date
(
2020
-
01
-
01
),
new
Date
(
2018
-
01
-
01
),
new
Date
(
2018
-
02
-
15
),
new
Date
(
2018
-
02
-
15
),
"Mahesh"
,
"Mahesh"
);
when
(
userService
.
getEmployeesRoleData
(
"16127"
))
.
thenReturn
(
employeesRole
);
mockMvc
.
perform
(
get
(
"/user/getEmployeeRoleData"
).
param
(
"empId"
,
"16127"
)
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
jsonPath
(
"$.employeeId"
,
is
(
"16127"
)))
.
andDo
(
print
());
verify
(
userService
).
getEmployeesRoleData
(
"16127"
);
}
@Test
public
void
testgetEmployeeRoleDataForEmailIdSearch
()
throws
Exception
{
EmployeeRoles
employeesRole
=
new
EmployeeRoles
(
"5976ef15874c902c98b8a05d"
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
"user@nisum.com"
,
null
,
null
,
null
,
new
Date
(
2017
-
11
-
20
),
new
Date
(
2107
-
12
-
23
),
null
,
null
,
null
,
null
,
new
Date
(
2020
-
01
-
01
),
new
Date
(
2018
-
01
-
01
),
new
Date
(
2018
-
02
-
15
),
new
Date
(
2018
-
02
-
15
),
"Mahesh"
,
"Mahesh"
);
when
(
userService
.
getEmployeeRoleDataForSearchCriteria
(
"dummy@nisum.com"
,
"emailId"
)).
thenReturn
(
employeesRol
e
);
mockMvc
.
perform
(
get
(
"/user/getEmployeeRoleDataForSearchCriteria"
)
.
param
(
"searchId"
,
"dummy@nisum.com"
)
.
param
(
"searchAttribute"
,
"emailId
"
)
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
jsonPath
(
"$.employeeId"
,
is
(
"16209"
)))
.
andDo
(
print
());
verify
(
userService
).
getEmployeeRoleDataForSearchCriteria
(
"dummy@nisum.com"
,
"emailId"
);
}
@Test
public
void
testgetEmployeeRoleDataForEmployeeNameSearch
()
throws
Exception
{
EmployeeRoles
employeesRole
=
new
EmployeeRoles
(
"5976ef15874c902c98b8a05d"
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
"user@nisum.com"
,
null
,
null
,
null
,
new
Date
(
2017
-
11
-
20
),
new
Date
(
2107
-
12
-
23
),
null
,
null
,
null
,
null
,
new
Date
(
2020
-
01
-
01
),
new
Date
(
2018
-
01
-
01
),
new
Date
(
2018
-
02
-
15
),
new
Date
(
2018
-
02
-
15
),
"Mahesh"
,
"Mahesh"
);
;
when
(
userService
.
getEmployeeRoleDataForSearchCriteria
(
"Mahesh Kumar Gutam"
,
"employeeName"
))
.
thenReturn
(
employeesRole
);
mockMvc
.
perform
(
get
(
"/user/getEmployeeRoleDataForSearchCriteria"
)
.
param
(
"searchId"
,
"Mahesh Kumar Gutam"
)
.
param
(
"searchAttribute"
,
"employeeName"
)
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
jsonPath
(
"$.employeeId"
,
is
(
"16209"
)))
.
andDo
(
print
());
verify
(
userService
).
getEmployeeRoleDataForSearchCriteria
(
"Mahesh Kumar Gutam"
,
"employeeName"
);
}
@Test
public
void
testGetEmployeeDetailsForAutocomplete
()
throws
Exception
{
List
<
String
>
details
=
new
ArrayList
<>(
);
details
.
add
(
"16294"
);
details
.
add
(
"Ashwin Kumar"
);
details
.
add
(
"kashwin@nisum.com"
);
details
.
add
(
"16209"
);
details
.
add
(
"Mahesh Kumar Gutam"
);
details
.
add
(
"mgutam@nisum.com
"
);
details
.
add
(
"16143
"
);
details
.
add
(
"Ajay
"
);
details
.
add
(
"ajayS@nisum.com
"
);
details
.
add
(
"16207
"
);
details
.
add
(
"Sumith Kumar Lambu
"
);
details
.
add
(
"slambu@nisum.com
"
);
details
.
add
(
"16111
"
);
details
.
add
(
"Mahesh Mudrakolu
"
);
details
.
add
(
"mmahesh@nisum.com
"
);
when
(
userService
.
getEmployeeDetailsForAutocomplete
())
.
thenReturn
(
details
);
mockMvc
.
perform
(
get
(
"/user/getEmployeeDetailsForAutocomplete"
)
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andDo
(
print
()
);
verify
(
userService
).
getEmployeeDetailsForAutocomplete
();
}
@Test
public
void
testgetManagers
()
throws
Exception
{
List
<
EmployeeRoles
>
employeesRole4
=
CreateUserRoles
();
System
.
out
.
println
(
employeesRole4
);
when
(
userService
.
getEmployeeRoles
()).
thenReturn
(
employeesRole4
);
mockMvc
.
perform
(
get
(
"/user/getManagers"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
()
);
verify
(
userService
).
getEmployeeRoles
(
);
}
@Test
public
void
testgetAllShifts
()
throws
Exception
{
List
<
Shift
>
shifts
=
CreateShifts
();
when
(
userService
.
getAllShifts
()).
thenReturn
(
shifts
);
mockMvc
.
perform
(
get
(
"/user/getAllShifts"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
getAllShifts
();
}
@Test
public
void
testgetAllDesignations
()
throws
Exception
{
List
<
Designation
>
designation
=
CreateDesignations
();
when
(
userService
.
getAllDesignations
()).
thenReturn
(
designation
);
mockMvc
.
perform
(
get
(
"/user/getAllDesignations"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
()
);
verify
(
userService
).
getAllDesignations
();
}
@Test
public
void
testgetTechnologies
()
throws
Exception
{
List
<
Skill
>
skills
=
CreateSkill
(
);
System
.
out
.
printl
n
(
skills
);
when
(
userService
.
getTechnologies
()).
thenReturn
(
skills
);
mockMvc
.
perform
(
get
(
"/user/getSkills"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
getTechnologies
();
}
@Test
public
void
testupdateProfile
()
throws
Exception
{
EmployeeRoles
employeeRole
=
new
EmployeeRoles
(
"5976ef15874c902c98b8a05d"
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
"user@nisum.com"
,
null
,
null
,
null
,
new
Date
(
2017
-
11
-
20
),
new
Date
(
2107
-
12
-
23
),
null
,
null
,
null
,
null
,
new
Date
(
2020
-
01
-
01
),
new
Date
(
2018
-
01
-
01
),
new
Date
(
2018
-
02
-
15
),
new
Date
(
2018
-
02
-
15
),
"Mahesh"
,
"Mahesh"
);;
System
.
out
.
println
(
employeeRole
);
ObjectMapper
mapper
=
new
ObjectMapper
();
String
jsonString
=
mapper
.
writeValueAsString
(
employeeRole
);
System
.
out
.
println
(
jsonString
);
when
(
userService
.
updateProfile
(
anyObject
())).
thenReturn
(
employeeRole
);
mockMvc
.
perform
(
post
(
"/user/updateProfile"
)
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)
.
content
(
jsonString
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
updateProfile
(
anyObject
());
}
@Test
public
void
getAccounts
()
throws
Exception
{
List
<
Account
>
account
=
CreateAccount
();
System
.
out
.
println
(
account
);
when
(
userService
.
getAccounts
()).
thenRetur
n
(
account
);
mockMvc
.
perform
(
get
(
"/user/getAccounts"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
getAccounts
();
}
@Test
@Mock
UserService
userService
;
@Mock
RoleMappingService
roleMappingService
;
@InjectMocks
UserController
userController
;
private
MockMvc
mockMvc
;
@Before
public
void
setup
()
{
MockitoAnnotations
.
initMocks
(
this
);
mockMvc
=
MockMvcBuilders
.
standaloneSetup
(
userController
).
build
();
}
@Test
public
void
testgetEmployeeRoleAsAdmin
()
throws
Exception
{
EmployeeRoles
employeesRole
=
new
EmployeeRoles
(
"5b307d7e708ef705c4ca64d8"
,
"16694"
,
"Mahesh Deekonda"
,
"mdeekonda@nisum.com"
,
"Admin"
,
"Senior software engineer"
,
null
,
null
,
"Support"
,
"Hyderabad"
,
null
,
null
,
null
,
null
,
"ACI - Support"
,
"Active"
,
null
,
new
Date
(
2017
-
11
-
20
),
new
Date
(
2107
-
12
-
23
),
"Male"
,
null
,
new
Date
(
2020
-
01
-
01
),
null
,
new
Date
(
2018
-
01
-
01
),
new
Date
(
2018
-
02
-
15
),
new
Date
(
2018
-
02
-
15
),
null
,
"Mahesh"
,
"Mahesh"
);
;
when
(
userService
.
getEmployeesRole
(
"mdeekonda@nisum.com"
)).
thenReturn
(
employeesRole
);
mockMvc
.
perform
(
get
(
"/user/employee"
).
param
(
"emailId"
,
"mdeekonda@nisum.com"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
getEmployeesRole
(
"mdeekonda@nisum.com"
);
}
@Test
public
void
testgetEmployeeRoleAsEmp
()
throws
Exception
{
EmployeeRoles
employeesRole
=
new
EmployeeRoles
(
"5b307d7e708ef705c4ca64d8"
,
"16694"
,
"Mahesh Deekonda"
,
"mdeekonda@nisum.com"
,
"Employee"
,
"Senior software engineer"
,
null
,
null
,
"Support"
,
"Hyderabad"
,
null
,
null
,
null
,
null
,
"ACI - Support"
,
"Active"
,
null
,
new
Date
(
2017
-
11
-
20
),
new
Date
(
2107
-
12
-
23
)
,
"Male"
,
null
,
new
Date
(
2020
-
01
-
01
),
null
,
new
Date
(
2018
-
01
-
01
),
new
Date
(
2018
-
02
-
15
),
new
Date
(
2018
-
02
-
15
),
null
,
"Mahesh"
,
"Mahesh"
);
when
(
userService
.
getEmployeesRole
(
"mdeekonda@nisum.com"
)).
thenReturn
(
employeesRole
);
when
(
roleMappingService
.
getEmployeeRole
(
employeesRole
.
getEmployeeId
())).
thenReturn
(
"Delivery Lead"
);
mockMvc
.
perform
(
get
(
"/user/employee"
).
param
(
"emailId"
,
"mdeekonda@nisum.com"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
getEmployeesRole
(
"mdeekonda@nisum.com"
);
verify
(
roleMappingService
).
getEmployeeRole
(
"16694"
);
}
@Test
public
void
testassigingEmployeeRole
()
throws
Exception
{
EmployeeRoles
employeeRole
=
new
EmployeeRoles
(
"5976ef15874c902c98b8a05d"
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
"user@nisum.com"
,
null
,
null
,
null
,
new
Date
(
2017
-
11
-
20
),
new
Date
(
2107
-
12
-
23
),
null
,
null
,
null
,
null
,
new
Date
(
2020
-
01
-
01
),
new
Date
(
2018
-
01
-
01
),
new
Date
(
2018
-
02
-
15
),
new
Date
(
2018
-
02
-
15
),
"Mahesh"
,
"Mahesh"
);
ObjectMapper
mapper
=
new
ObjectMapper
();
String
jsonString
=
mapper
.
writeValueAsString
(
employeeRole
);
when
(
userService
.
assigingEmployeeRole
(
anyObject
(),
anyObject
())).
thenReturn
(
employeeRole
);
mockMvc
.
perform
(
post
(
"/user/assignEmployeeRole"
).
param
(
"empId"
,
"16999"
)
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
).
content
(
jsonString
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
()
);
verify
(
userService
).
assigingEmployeeRole
(
anyObject
(),
anyObject
()
);
}
@Test
public
void
testupdateEmployeeRole
()
throws
Exception
{
EmployeeRoles
employeeRole2
=
new
EmployeeRoles
(
"5976ef15874c902c98b8a05d"
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
"user@nisum.com"
,
null
,
null
,
null
,
new
Date
(
2017
-
11
-
20
),
new
Date
(
2107
-
12
-
23
),
null
,
null
,
null
,
null
,
new
Date
(
2020
-
01
-
01
),
new
Date
(
2018
-
01
-
01
),
new
Date
(
2018
-
02
-
15
),
new
Date
(
2018
-
02
-
15
),
"Mahesh"
,
"Mahesh"
);
ObjectMapper
mapper
=
new
ObjectMapper
();
String
jsonString
=
mapper
.
writeValueAsString
(
employeeRole2
);
when
(
userService
.
updateEmployeeRole
(
anyObject
(),
anyObject
())).
thenReturn
(
employeeRole2
);
mockMvc
.
perform
(
post
(
"/user/updateEmployeeRole"
).
param
(
"empId"
,
"16999"
)
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
).
content
(
jsonString
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
updateEmployeeRole
(
anyObject
(),
anyObject
()
);
}
@Test
public
void
testdeleteEmployee
()
throws
Exception
{
mockMvc
.
perform
(
delete
(
"/user/deleteEmployee"
).
param
(
"empId"
,
"16127"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
()
);
verify
(
userService
).
deleteEmployee
(
"16127"
);
}
@Test
public
void
testgetUserRoles
()
throws
Exception
{
List
<
EmployeeRoles
>
employeesRole3
=
CreateUserRoles
();
when
(
userService
.
getEmployeeRoles
()).
thenReturn
(
employeesRole3
);
mockMvc
.
perform
(
get
(
"/user/getUserRoles"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
getEmployeeRoles
();
}
@Test
public
void
testgetEmployeeRoleData
()
throws
Exception
{
EmployeeRoles
employeesRole
=
new
EmployeeRoles
(
"5b307d7e708ef705c4ca64d8"
,
"16694"
,
"Mahesh Deekonda"
,
"mdeekonda@nisum.com"
,
"Admin"
,
"Senior software engineer"
,
null
,
null
,
"Support"
,
"Hyderabad"
,
null
,
null
,
null
,
null
,
"ACI - Support"
,
"Active"
,
null
,
new
Date
(
2017
-
11
-
20
),
new
Date
(
2107
-
12
-
23
),
"Male"
,
null
,
new
Date
(
2020
-
01
-
01
),
null
,
new
Date
(
2018
-
01
-
01
),
new
Date
(
2018
-
02
-
15
),
new
Date
(
2018
-
02
-
15
),
null
,
"Mahesh"
,
"Mahesh"
);
when
(
userService
.
getEmployeesRoleData
(
"16694"
)).
thenReturn
(
employeesRole
);
mockMvc
.
perform
(
get
(
"/user/getEmployeeRoleData"
).
param
(
"empId"
,
"16694"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
()).
andExpect
(
jsonPath
(
"$.employeeId"
,
is
(
"16694"
)))
.
andDo
(
print
());
verify
(
userService
).
getEmployeesRoleData
(
"16694"
);
}
@Test
public
void
testgetEmployeeLocations
()
throws
Exception
{
List
<
EmployeeLocationDetails
>
empLocList
=
new
ArrayList
<
EmployeeLocationDetails
>();
EmployeeLocationDetails
empLocation
=
new
EmployeeLocationDetails
(
new
ObjectId
(
"5b307d7d708ef705c4ca59c4"
),
"16090"
,
"Dharmendra Kumar Jampana"
,
"Hyderabad"
,
new
Date
(
2020
-
01
-
01
),
new
Date
(
2018
-
01
-
01
)
,
new
Date
(
2018
-
02
-
15
),
new
Date
(
2018
-
02
-
15
),
tru
e
);
empLocList
.
add
(
empLocation
);
when
(
userService
.
getEmployeeLocationDetails
(
"16090"
)).
thenReturn
(
empLocList
);
mockMvc
.
perform
(
get
(
"/user/getEmployeeLocations"
).
param
(
"employeeId"
,
"16090
"
)
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
getEmployeeLocationDetails
(
"16090"
);
}
@Test
public
void
testgetEmployeeRoleDataForEmailIdSearch
()
throws
Exception
{
EmployeeRoles
employeesRole
=
new
EmployeeRoles
(
"5b307d7d708ef705c4ca5c90"
,
"16209"
,
"Mahesh Kumar Gutam"
,
"dummy@nisum.com"
,
"Employee"
,
"Software Engineer"
,
null
,
null
,
"Sell"
,
"Hyderabad"
,
null
,
null
,
null
,
null
,
"APPS"
,
"Active"
,
"Full Time"
,
new
Date
(
2017
-
11
-
20
),
new
Date
(
2107
-
12
-
23
),
"Male"
,
null
,
null
,
null
,
new
Date
(
2020
-
01
-
01
),
new
Date
(
2018
-
01
-
01
),
new
Date
(
2018
-
02
-
15
),
new
Date
(
2018
-
02
-
15
),
"Mahesh"
,
"Mahesh"
);
when
(
userService
.
getEmployeeRoleDataForSearchCriteria
(
"dummy@nisum.com"
,
"emailId"
)).
thenReturn
(
employeesRole
);
mockMvc
.
perform
(
get
(
"/user/getEmployeeRoleDataForSearchCriteria"
).
param
(
"searchId"
,
"dummy@nisum.com"
)
.
param
(
"searchAttribute"
,
"emailId"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
()).
andExpect
(
jsonPath
(
"$.employeeId"
,
is
(
"16209"
)))
.
andDo
(
print
()
);
verify
(
userService
).
getEmployeeRoleDataForSearchCriteria
(
"dummy@nisum.com"
,
"emailId"
)
;
}
@Test
public
void
testgetEmployeeRoleDataForEmployeeNameSearch
()
throws
Exception
{
EmployeeRoles
employeesRole
=
new
EmployeeRoles
(
"5b307d7d708ef705c4ca5c90"
,
"16209"
,
"Mahesh Kumar Gutam"
,
"dummy@nisum.com"
,
"Employee"
,
"Software Engineer"
,
null
,
null
,
"Sell"
,
"Hyderabad"
,
null
,
null
,
null
,
null
,
"APPS"
,
"Active"
,
"Full Time"
,
new
Date
(
2017
-
11
-
20
),
new
Date
(
2107
-
12
-
23
),
"Male"
,
null
,
null
,
null
,
new
Date
(
2020
-
01
-
01
),
new
Date
(
2018
-
01
-
01
),
new
Date
(
2018
-
02
-
15
),
new
Date
(
2018
-
02
-
15
),
"Mahesh"
,
"Mahesh"
);
when
(
userService
.
getEmployeeRoleDataForSearchCriteria
(
"Mahesh Kumar Gutam"
,
"employeeName"
))
.
thenReturn
(
employeesRole
);
mockMvc
.
perform
(
get
(
"/user/getEmployeeRoleDataForSearchCriteria"
).
param
(
"searchId"
,
"Mahesh Kumar Gutam"
)
.
param
(
"searchAttribute"
,
"employeeName"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
()).
andExpect
(
jsonPath
(
"$.employeeId"
,
is
(
"16209"
)))
.
andDo
(
print
());
verify
(
userService
).
getEmployeeRoleDataForSearchCriteria
(
"Mahesh Kumar Gutam"
,
"employeeName"
);
}
@Test
public
void
testGetEmployeeDetailsForAutocomplete
()
throws
Exception
{
List
<
String
>
details
=
new
ArrayList
<>(
);
details
.
add
(
"16294
"
);
details
.
add
(
"Ashwin Kumar
"
);
details
.
add
(
"kashwin@nisum.com
"
);
details
.
add
(
"16209
"
);
details
.
add
(
"Mahesh Kumar Gutam
"
);
details
.
add
(
"mgutam@nisum.com
"
);
details
.
add
(
"16143
"
);
details
.
add
(
"Ajay
"
);
details
.
add
(
"ajayS@nisum.com
"
);
details
.
add
(
"16207
"
);
details
.
add
(
"Sumith Kumar Lambu"
);
details
.
add
(
"slambu@nisum.com"
);
details
.
add
(
"16111"
);
details
.
add
(
"Mahesh Mudrakolu"
);
details
.
add
(
"mmahesh@nisum.com"
);
when
(
userService
.
getEmployeeDetailsForAutocomplete
()).
thenReturn
(
details
);
mockMvc
.
perform
(
get
(
"/user/getEmployeeDetailsForAutocomplete"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
()).
andDo
(
print
());
verify
(
userService
).
getEmployeeDetailsForAutocomplete
();
}
@Test
public
void
testgetManagers
()
throws
Exception
{
List
<
EmployeeRoles
>
employeesRole4
=
CreateUserRoles
(
);
System
.
out
.
println
(
employeesRole4
);
when
(
userService
.
getEmployeeRoles
()).
thenReturn
(
employeesRole4
);
mockMvc
.
perform
(
get
(
"/user/getManagers"
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
()
);
verify
(
userService
).
getEmployeeRoles
();
}
@Test
public
void
testgetAllShifts
()
throws
Exception
{
List
<
Shift
>
shifts
=
CreateShifts
(
);
when
(
userService
.
getAllShifts
()).
thenReturn
(
shifts
);
mockMvc
.
perform
(
get
(
"/user/getAllShifts"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
getAllShifts
();
}
@Test
public
void
testgetAllDesignations
()
throws
Exception
{
List
<
Designation
>
designation
=
CreateDesignations
();
when
(
userService
.
getAllDesignations
()).
thenReturn
(
designation
);
mockMvc
.
perform
(
get
(
"/user/getAllDesignations"
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
getAllDesignations
(
);
}
@Test
public
void
testgetTechnologies
()
throws
Exception
{
List
<
Skill
>
skills
=
CreateSkill
();
System
.
out
.
println
(
skills
);
when
(
userService
.
getTechnologies
()).
thenRetur
n
(
skills
);
mockMvc
.
perform
(
get
(
"/user/getSkills"
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
()
);
verify
(
userService
).
getTechnologies
();
}
@Test
public
void
testgetLocations
()
throws
Exception
{
when
(
userService
.
getLocations
()).
thenReturn
(
locations
());
mockMvc
.
perform
(
get
(
"/user/getLocations"
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
,
atLeastOnce
()).
getLocations
();
}
@Test
public
void
testupdateProfile
()
throws
Exception
{
EmployeeRoles
employeeRole
=
new
EmployeeRoles
(
"5976ef15874c902c98b8a05d"
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
"user@nisum.com"
,
null
,
null
,
null
,
new
Date
(
2017
-
11
-
20
),
new
Date
(
2107
-
12
-
23
),
null
,
null
,
null
,
null
,
new
Date
(
2020
-
01
-
01
),
new
Date
(
2018
-
01
-
01
),
new
Date
(
2018
-
02
-
15
),
new
Date
(
2018
-
02
-
15
),
"Mahesh"
,
"Mahesh"
);
System
.
out
.
println
(
employeeRole
);
ObjectMapper
mapper
=
new
ObjectMapper
(
);
String
jsonString
=
mapper
.
writeValueAsString
(
employeeRole
);
System
.
out
.
println
(
jsonString
);
when
(
userService
.
updateProfile
(
anyObject
())).
thenReturn
(
employeeRole
);
mockMvc
.
perform
(
post
(
"/user/updateProfile"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
).
content
(
jsonString
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
updateProfile
(
anyObject
());
}
@Test
public
void
getAccounts
()
throws
Exception
{
List
<
Account
>
account
=
CreateAccount
(
);
System
.
out
.
printl
n
(
account
);
when
(
userService
.
getAccounts
()).
thenReturn
(
account
);
mockMvc
.
perform
(
get
(
"/user/getAccounts"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
getAccounts
();
}
@Test
public
void
testGetMasterData
()
throws
Exception
{
List
<
MasterData
>
masterDataMap
=
masterData
();
when
(
userService
.
getMasterData
()).
thenReturn
(
masterDataMap
);
...
...
@@ -298,129 +305,161 @@ public class UserControllerTest {
verify
(
userService
).
getEmployeesByStatus
(
"Active"
);
}
@Test
public
void
testgetdomains
()
throws
Exception
{
when
(
userService
.
getDomains
(
"Acc001"
)).
thenReturn
(
domains
());
mockMvc
.
perform
(
get
(
"/user/getDomains"
).
param
(
"accountId"
,
"Acc001"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
getDomains
(
"Acc001"
);
}
@Test
public
void
testgetDeliveryLeads
()
throws
Exception
{
HashMap
<
String
,
String
>
dl1
=
new
HashMap
<
String
,
String
>();
dl1
.
put
(
"employeeName"
,
"Madhuri Bayyagari"
);
dl1
.
put
(
"employeeId"
,
"16620"
);
HashMap
<
String
,
String
>
dl2
=
new
HashMap
<
String
,
String
>();
dl2
.
put
(
"employeeName"
,
"Sridhar Swamy Perumbaduri"
);
dl2
.
put
(
"employeeId"
,
"16630"
);
List
<
HashMap
<
String
,
String
>>
dlList
=
new
ArrayList
<
HashMap
<
String
,
String
>>();
dlList
.
add
(
dl1
);
dlList
.
add
(
dl2
);
when
(
userService
.
getDeliveryLeads
(
"DOM001"
)).
thenReturn
(
dlList
);
mockMvc
.
perform
(
get
(
"/user/getDeliveryLeads"
).
param
(
"domainId"
,
"DOM001"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
getDeliveryLeads
(
"DOM001"
);
private
List
<
Account
>
CreateAccount
()
{
List
<
Account
>
data
=
new
ArrayList
<>();
Account
account1
=
new
Account
();
account1
.
setId
(
new
ObjectId
(
"5976ef15874c902c98b8a05d"
));
account1
.
setAccountId
(
"01"
);
account1
.
setAccountName
(
"GAP"
);
account1
.
setAccountProjectSequence
(
1
);
account1
.
setStatus
(
"Active"
);
data
.
add
(
account1
);
Account
account2
=
new
Account
();
account2
.
setId
(
new
ObjectId
(
"2476ef15874c902c98b8a05d"
));
account2
.
setAccountId
(
"02"
);
account2
.
setAccountName
(
"MACYS"
);
account2
.
setAccountProjectSequence
(
2
);
account2
.
setStatus
(
"Non-Active"
);
data
.
add
(
account2
);
return
data
;
}
private
List
<
Skill
>
CreateSkill
()
{
List
<
Skill
>
data
=
new
ArrayList
<>();
Skill
skills1
=
new
Skill
();
skills1
.
setId
(
new
ObjectId
(
"5976ef15874c902c98b8a05d"
));
skills1
.
setSkillId
(
"01"
);
skills1
.
setSkillName
(
"Java"
);
skills1
.
setActiveStatus
(
"Active"
);
data
.
add
(
skills1
);
Skill
skills2
=
new
Skill
();
skills2
.
setId
(
new
ObjectId
(
"2476ef15874c902c98b8a05d"
));
skills2
.
setSkillId
(
"02"
);
skills2
.
setSkillName
(
"Big Data"
);
skills2
.
setActiveStatus
(
"Active"
);
data
.
add
(
skills2
);
return
data
;
}
private
List
<
Designation
>
CreateDesignations
()
{
List
<
Designation
>
data
=
new
ArrayList
<>();
Designation
desig1
=
new
Designation
();
desig1
.
setId
(
new
ObjectId
(
"5976ef15874c902c98b8a05d"
));
desig1
.
setDesignationId
(
"01"
);
desig1
.
setDesignationName
(
"Manager"
);
desig1
.
setActiveStatus
(
"Active"
);
data
.
add
(
desig1
);
Designation
desig2
=
new
Designation
();
desig2
.
setId
(
new
ObjectId
(
"2476ef15874c902c98b8a05d"
));
desig2
.
setDesignationId
(
"02"
);
desig2
.
setDesignationName
(
"Employee"
);
desig2
.
setActiveStatus
(
"Active"
);
data
.
add
(
desig2
);
return
data
;
}
private
List
<
Shift
>
CreateShifts
()
{
List
<
Shift
>
data
=
new
ArrayList
<>();
Shift
shift1
=
new
Shift
();
shift1
.
setId
(
new
ObjectId
(
"5976ef15874c902c98b8a05d"
));
shift1
.
setShiftId
(
"01"
);
shift1
.
setShiftName
(
"Morning Shift"
);
shift1
.
setActiveStatus
(
"Active"
);
data
.
add
(
shift1
);
Shift
shift2
=
new
Shift
();
shift2
.
setId
(
new
ObjectId
(
"2476ef15874c902c98b8a05d"
));
shift2
.
setShiftId
(
"02"
);
shift2
.
setShiftName
(
"Night Shift"
);
shift2
.
setActiveStatus
(
"Active"
);
data
.
add
(
shift2
);
return
data
;
}
private
List
<
EmployeeRoles
>
CreateUserRoles
()
{
List
<
EmployeeRoles
>
data
=
new
ArrayList
<>();
EmployeeRoles
data1
=
new
EmployeeRoles
();
data1
.
setId
(
"3976ef15874c902c98b8a05d"
);
data1
.
setEmployeeId
(
"16101"
);
data1
.
setEmployeeName
(
"Abc"
);
data1
.
setEmailId
(
"user1@nisum.com"
);
data1
.
setRole
(
"HR"
);
data1
.
setDesignation
(
"Human Resource Manager"
);
data1
.
setShift
(
"09:00-06:00"
);
data1
.
setBaseTechnology
(
"Spring"
);
data1
.
setTechnologyKnown
(
"Jmeter"
);
data1
.
setMobileNumber
(
"9978567809"
);
data1
.
setAlternateMobileNumber
(
"7789092345"
);
data1
.
setPersonalEmailId
(
"user1@gmail.com"
);
data1
.
setCreatedOn
(
new
Date
(
2017
-
11
-
21
));
data1
.
setLastModifiedOn
(
new
Date
(
2017
-
12
-
22
));
EmployeeRoles
data2
=
new
EmployeeRoles
();
data2
.
setId
(
"4976ef15874c902c98b8a05d"
);
data2
.
setEmployeeId
(
"16102"
);
data2
.
setEmployeeName
(
"Xyz"
);
data2
.
setEmailId
(
"user2@nisum.com"
);
data2
.
setRole
(
"Manager"
);
data2
.
setDesignation
(
"Senior Software Engineer"
);
data2
.
setShift
(
"03:00-12:00"
);
data2
.
setBaseTechnology
(
"Hibernate"
);
data2
.
setTechnologyKnown
(
"EJB"
);
data2
.
setMobileNumber
(
"9989087671"
);
data2
.
setAlternateMobileNumber
(
"9999786756"
);
data2
.
setPersonalEmailId
(
"user2@gmail.com"
);
data2
.
setCreatedOn
(
new
Date
(
2017
-
11
-
23
));
data2
.
setLastModifiedOn
(
new
Date
(
2017
-
12
-
22
));
data
.
add
(
data1
);
data
.
add
(
data2
);
return
data
;
}
private
List
<
MasterData
>
masterData
()
{
}
private
List
<
Account
>
CreateAccount
()
{
List
<
Account
>
data
=
new
ArrayList
<>();
Account
account1
=
new
Account
();
account1
.
setId
(
new
ObjectId
(
"5976ef15874c902c98b8a05d"
));
account1
.
setAccountId
(
"01"
);
account1
.
setAccountName
(
"GAP"
);
account1
.
setAccountProjectSequence
(
1
);
account1
.
setStatus
(
"Active"
);
data
.
add
(
account1
);
Account
account2
=
new
Account
();
account2
.
setId
(
new
ObjectId
(
"2476ef15874c902c98b8a05d"
));
account2
.
setAccountId
(
"02"
);
account2
.
setAccountName
(
"MACYS"
);
account2
.
setAccountProjectSequence
(
2
);
account2
.
setStatus
(
"Non-Active"
);
data
.
add
(
account2
);
return
data
;
}
private
List
<
Skill
>
CreateSkill
()
{
List
<
Skill
>
data
=
new
ArrayList
<>();
Skill
skills1
=
new
Skill
();
skills1
.
setId
(
new
ObjectId
(
"5976ef15874c902c98b8a05d"
));
skills1
.
setSkillId
(
"01"
);
skills1
.
setSkillName
(
"Java"
);
skills1
.
setActiveStatus
(
"Active"
);
data
.
add
(
skills1
);
Skill
skills2
=
new
Skill
();
skills2
.
setId
(
new
ObjectId
(
"2476ef15874c902c98b8a05d"
));
skills2
.
setSkillId
(
"02"
);
skills2
.
setSkillName
(
"Big Data"
);
skills2
.
setActiveStatus
(
"Active"
);
data
.
add
(
skills2
);
return
data
;
}
private
List
<
Designation
>
CreateDesignations
()
{
List
<
Designation
>
data
=
new
ArrayList
<>();
Designation
desig1
=
new
Designation
();
desig1
.
setId
(
new
ObjectId
(
"5976ef15874c902c98b8a05d"
));
desig1
.
setDesignationId
(
"01"
);
desig1
.
setDesignationName
(
"Manager"
);
desig1
.
setActiveStatus
(
"Active"
);
data
.
add
(
desig1
);
Designation
desig2
=
new
Designation
();
desig2
.
setId
(
new
ObjectId
(
"2476ef15874c902c98b8a05d"
));
desig2
.
setDesignationId
(
"02"
);
desig2
.
setDesignationName
(
"Employee"
);
desig2
.
setActiveStatus
(
"Active"
);
data
.
add
(
desig2
);
return
data
;
}
private
List
<
Shift
>
CreateShifts
()
{
List
<
Shift
>
data
=
new
ArrayList
<>();
Shift
shift1
=
new
Shift
();
shift1
.
setId
(
new
ObjectId
(
"5976ef15874c902c98b8a05d"
));
shift1
.
setShiftId
(
"01"
);
shift1
.
setShiftName
(
"Morning Shift"
);
shift1
.
setActiveStatus
(
"Active"
);
data
.
add
(
shift1
);
Shift
shift2
=
new
Shift
();
shift2
.
setId
(
new
ObjectId
(
"2476ef15874c902c98b8a05d"
));
shift2
.
setShiftId
(
"02"
);
shift2
.
setShiftName
(
"Night Shift"
);
shift2
.
setActiveStatus
(
"Active"
);
data
.
add
(
shift2
);
return
data
;
}
private
List
<
EmployeeRoles
>
CreateUserRoles
()
{
List
<
EmployeeRoles
>
data
=
new
ArrayList
<>();
EmployeeRoles
data1
=
new
EmployeeRoles
();
data1
.
setId
(
"3976ef15874c902c98b8a05d"
);
data1
.
setEmployeeId
(
"16101"
);
data1
.
setEmployeeName
(
"Abc"
);
data1
.
setEmailId
(
"user1@nisum.com"
);
data1
.
setRole
(
"HR"
);
data1
.
setDesignation
(
"Human Resource Manager"
);
data1
.
setShift
(
"09:00-06:00"
);
data1
.
setBaseTechnology
(
"Spring"
);
data1
.
setTechnologyKnown
(
"Jmeter"
);
data1
.
setMobileNumber
(
"9978567809"
);
data1
.
setAlternateMobileNumber
(
"7789092345"
);
data1
.
setPersonalEmailId
(
"user1@gmail.com"
);
data1
.
setCreatedOn
(
new
Date
(
2017
-
11
-
21
));
data1
.
setLastModifiedOn
(
new
Date
(
2017
-
12
-
22
));
EmployeeRoles
data2
=
new
EmployeeRoles
();
data2
.
setId
(
"4976ef15874c902c98b8a05d"
);
data2
.
setEmployeeId
(
"16102"
);
data2
.
setEmployeeName
(
"Xyz"
);
data2
.
setEmailId
(
"user2@nisum.com"
);
data2
.
setRole
(
"Manager"
);
data2
.
setDesignation
(
"Senior Software Engineer"
);
data2
.
setShift
(
"03:00-12:00"
);
data2
.
setBaseTechnology
(
"Hibernate"
);
data2
.
setTechnologyKnown
(
"EJB"
);
data2
.
setMobileNumber
(
"9989087671"
);
data2
.
setAlternateMobileNumber
(
"9999786756"
);
data2
.
setPersonalEmailId
(
"user2@gmail.com"
);
data2
.
setCreatedOn
(
new
Date
(
2017
-
11
-
23
));
data2
.
setLastModifiedOn
(
new
Date
(
2017
-
12
-
22
));
data
.
add
(
data1
);
data
.
add
(
data2
);
return
data
;
}
private
List
<
MasterData
>
masterData
()
{
List
<
MasterData
>
masterDataList
=
new
ArrayList
<
MasterData
>();
MasterData
md1
=
new
MasterData
();
md1
.
setActiveStatus
(
true
);
...
...
@@ -444,24 +483,52 @@ public class UserControllerTest {
return
masterDataList
;
}
private
List
<
EmployeeRoles
>
employeeRoles
()
{
private
List
<
EmployeeRoles
>
employeeRoles
()
{
List
<
EmployeeRoles
>
employeeRoles
=
new
ArrayList
<
EmployeeRoles
>();
EmployeeRoles
employeesRole1
=
new
EmployeeRoles
(
"5b307d7d708ef705c4ca5c90"
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
"dummy@nisum.com"
,
null
,
null
,
null
,
new
Date
(
2017
-
11
-
20
),
new
Date
(
2107
-
12
-
23
),
null
,
null
,
null
,
null
,
new
Date
(
2020
-
01
-
01
),
new
Date
(
2018
-
01
-
01
),
new
Date
(
2018
-
02
-
15
),
new
Date
(
2018
-
02
-
15
),
"Mahesh"
,
"Mahesh"
);
EmployeeRoles
employeesRole2
=
new
EmployeeRoles
(
"5976ef15874c902c98b8a05d"
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
"user@nisum.com"
,
null
,
null
,
null
,
new
Date
(
2017
-
11
-
20
),
new
Date
(
2107
-
12
-
23
),
null
,
null
,
null
,
null
,
new
Date
(
2020
-
01
-
01
),
new
Date
(
2018
-
01
-
01
),
new
Date
(
2018
-
02
-
15
),
new
Date
(
2018
-
02
-
15
),
"Mahesh"
,
"Mahesh"
);
EmployeeRoles
employeesRole1
=
new
EmployeeRoles
(
"5b307d7d708ef705c4ca5c90"
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
"dummy@nisum.com"
,
null
,
null
,
null
,
new
Date
(
2017
-
11
-
20
),
new
Date
(
2107
-
12
-
23
),
null
,
null
,
null
,
null
,
new
Date
(
2020
-
01
-
01
),
new
Date
(
2018
-
01
-
01
),
new
Date
(
2018
-
02
-
15
),
new
Date
(
2018
-
02
-
15
),
"Mahesh"
,
"Mahesh"
);
EmployeeRoles
employeesRole2
=
new
EmployeeRoles
(
"5976ef15874c902c98b8a05d"
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
"user@nisum.com"
,
null
,
null
,
null
,
new
Date
(
2017
-
11
-
20
),
new
Date
(
2107
-
12
-
23
),
null
,
null
,
null
,
null
,
new
Date
(
2020
-
01
-
01
),
new
Date
(
2018
-
01
-
01
),
new
Date
(
2018
-
02
-
15
),
new
Date
(
2018
-
02
-
15
),
"Mahesh"
,
"Mahesh"
);
employeeRoles
.
add
(
employeesRole1
);
employeeRoles
.
add
(
employeesRole2
);
return
employeeRoles
;
}
private
List
<
Location
>
locations
()
{
List
<
Location
>
empLocation
=
new
ArrayList
<
Location
>();
Location
l1
=
new
Location
(
new
ObjectId
(
"5b307c9c927173017882543b"
),
"IN_HYD"
,
"Hyderabad Appstek Building"
,
"India"
,
"Telangana"
,
"Hyderabad"
,
true
,
"testing"
);
Location
l2
=
new
Location
(
new
ObjectId
(
"5b307c9c927173017882543a"
),
"NY_SF"
,
"Pleasonton Gap Office"
,
"USA"
,
"CA"
,
"SanFransisco"
,
true
,
"testing"
);
empLocation
.
add
(
l1
);
empLocation
.
add
(
l2
);
return
empLocation
;
}
private
List
<
Domains
>
domains
()
{
List
<
String
>
dl1
=
new
ArrayList
<
String
>();
dl1
.
add
(
"16120"
);
dl1
.
add
(
"16121"
);
List
<
String
>
dl2
=
new
ArrayList
<
String
>();
dl2
.
add
(
"16122"
);
dl2
.
add
(
"16123"
);
List
<
Domains
>
domains
=
new
ArrayList
<
Domains
>();
Domains
d1
=
new
Domains
(
new
ObjectId
(
"5b61be677c43a53a634f77b1"
),
"DOM001"
,
"Customer"
,
"Acc001"
,
"Active"
,
dl1
);
Domains
d2
=
new
Domains
(
new
ObjectId
(
"5b76b7f5094e433005abbede"
),
"DOM005"
,
"rajesh"
,
"Acc001"
,
"Active"
,
dl2
);
domains
.
add
(
d1
);
domains
.
add
(
d2
);
return
domains
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment