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
963f6644
Commit
963f6644
authored
May 21, 2018
by
Rajeshekar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed the compilation errors in test cases and now the build is
successful
parent
ac5da2a9
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
896 additions
and
748 deletions
+896
-748
ProjectControllerTest.java
...om/nisum/mytime/controllertest/ProjectControllerTest.java
+144
-119
ProjectTeamControllerTest.java
...isum/mytime/controllertest/ProjectTeamControllerTest.java
+399
-342
UserControllerTest.java
...a/com/nisum/mytime/controllertest/UserControllerTest.java
+353
-287
No files found.
src/test/java/com/nisum/mytime/controllertest/ProjectControllerTest.java
View file @
963f6644
...
@@ -53,68 +53,94 @@ public class ProjectControllerTest {
...
@@ -53,68 +53,94 @@ public class ProjectControllerTest {
mockMvc
=
MockMvcBuilders
.
standaloneSetup
(
projectController
).
build
();
mockMvc
=
MockMvcBuilders
.
standaloneSetup
(
projectController
).
build
();
}
}
@Test
@Test
public
void
testgetEmployeeRole
()
throws
Exception
{
public
void
testgetEmployeeRole
()
throws
Exception
{
EmployeeRoles
employeesRole
=
new
EmployeeRoles
(
"5976ef15874c902c98b8a05d"
,
null
,
null
,
"user@nisum.com"
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
new
Date
(
2017
-
11
-
12
),
new
Date
(
2017
-
12
-
12
));
EmployeeRoles
employeesRole
=
new
EmployeeRoles
(
when
(
userService
.
getEmployeesRole
(
"user@nisum.com"
)).
thenReturn
(
employeesRole
);
"5976ef15874c902c98b8a05d"
,
null
,
null
,
"user@nisum.com"
,
null
,
mockMvc
.
perform
(
get
(
"/project/employee"
).
param
(
"emailId"
,
"user@nisum.com"
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
new
Date
(
2017
-
11
-
12
),
new
Date
(
2017
-
12
-
12
));
when
(
userService
.
getEmployeesRole
(
"user@nisum.com"
))
.
thenReturn
(
employeesRole
);
mockMvc
.
perform
(
get
(
"/project/employee"
).
param
(
"emailId"
,
"user@nisum.com"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
getEmployeesRole
(
"user@nisum.com"
);
verify
(
userService
).
getEmployeesRole
(
"user@nisum.com"
);
}
}
@Test
@Test
public
void
testaddProject
()
throws
Exception
{
public
void
testaddProject
()
throws
Exception
{
List
<
String
>
list
=
new
ArrayList
<>();
List
<
String
>
list
=
new
ArrayList
<>();
list
.
add
(
"16101"
);
list
.
add
(
"16101"
);
list
.
add
(
"16102"
);
list
.
add
(
"16102"
);
list
.
add
(
"16103"
);
list
.
add
(
"16103"
);
Project
employeeRole1
=
new
Project
(
new
ObjectId
(
"9976ef15874c902c98b8a05d"
),
"102"
,
"OMS"
,
"16101"
,
"Srikanth"
,
"Macys"
,
"Billable"
,
list
);
Project
employeeRole1
=
new
Project
(
String
jsonvalue
=(
new
ObjectMapper
()).
writeValueAsString
(
employeeRole1
).
toString
();
new
ObjectId
(
"9976ef15874c902c98b8a05d"
),
"102"
,
"OMS"
,
"16101"
,
Account
account
=
new
Account
(
new
ObjectId
(
"5a4f03661dca211ea7f94c02"
),
"2"
,
"Macys"
,
0
,
"Y"
);
"Srikanth"
,
"Macys"
,
"Billable"
,
list
);
when
(
projectService
.
addProject
(
employeeRole1
)).
thenReturn
(
employeeRole1
);
String
jsonvalue
=
(
new
ObjectMapper
())
.
writeValueAsString
(
employeeRole1
).
toString
();
Account
account
=
new
Account
(
new
ObjectId
(
"5a4f03661dca211ea7f94c02"
),
"2"
,
"Macys"
,
0
,
"Y"
);
when
(
projectService
.
addProject
(
employeeRole1
))
.
thenReturn
(
employeeRole1
);
when
(
accountRepo
.
findByAccountName
(
"Macys"
)).
thenReturn
(
account
);
when
(
accountRepo
.
findByAccountName
(
"Macys"
)).
thenReturn
(
account
);
mockMvc
.
perform
(
post
(
"/project/addProject"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
).
content
(
jsonvalue
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
mockMvc
.
perform
(
post
(
"/project/addProject"
)
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)
.
content
(
jsonvalue
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
}
}
@Test
@Test
public
void
testupdateEmployeeRole
()
throws
Exception
{
public
void
testupdateEmployeeRole
()
throws
Exception
{
List
<
String
>
list1
=
new
ArrayList
<>();
List
<
String
>
list1
=
new
ArrayList
<>();
list1
.
add
(
"16104"
);
list1
.
add
(
"16104"
);
list1
.
add
(
"16105"
);
list1
.
add
(
"16105"
);
list1
.
add
(
"16106"
);
list1
.
add
(
"16106"
);
Project
project
=
new
Project
(
new
ObjectId
(
"5976ef15874c902c98b8a05d"
),
"101"
,
"MOSAIC"
,
"16100"
,
"Rajeshekar"
,
"Gap"
,
"Billable"
,
list1
);
Project
project
=
new
Project
(
new
ObjectId
(
"5976ef15874c902c98b8a05d"
),
"101"
,
"MOSAIC"
,
"16100"
,
"Rajeshekar"
,
"Gap"
,
"Billable"
,
list1
);
ObjectMapper
mapper
=
new
ObjectMapper
();
ObjectMapper
mapper
=
new
ObjectMapper
();
String
jsonString
=
mapper
.
writeValueAsString
(
project
);
String
jsonString
=
mapper
.
writeValueAsString
(
project
);
when
(
projectService
.
updateProject
(
any
())).
thenReturn
(
project
);
when
(
projectService
.
updateProject
(
any
())).
thenReturn
(
project
);
mockMvc
.
perform
(
post
(
"/project/updateProject"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
).
content
(
jsonString
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
mockMvc
.
perform
(
post
(
"/project/updateProject"
)
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)
.
content
(
jsonString
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
projectService
).
updateProject
(
any
());
verify
(
projectService
).
updateProject
(
any
());
}
}
@Test
@Test
public
void
testdeleteProject
()
throws
Exception
{
public
void
testdeleteProject
()
throws
Exception
{
mockMvc
.
perform
(
delete
(
"/project/deleteProject"
).
param
(
"projectId"
,
"101"
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
mockMvc
.
perform
(
delete
(
"/project/deleteProject"
).
param
(
"projectId"
,
"101"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
projectService
).
deleteProject
(
"101"
);
verify
(
projectService
).
deleteProject
(
"101"
);
}
}
@Test
@Test
public
void
testgetProjects
()
throws
Exception
{
public
void
testgetProjects
()
throws
Exception
{
List
<
Project
>
projects
=
CreateProjectDetails
();
List
<
Project
>
projects
=
CreateProjectDetails
();
when
(
projectService
.
getProjects
()).
thenReturn
(
projects
);
when
(
projectService
.
getProjects
()).
thenReturn
(
projects
);
mockMvc
.
perform
(
get
(
"/project/getProjects"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
mockMvc
.
perform
(
get
(
"/project/getProjects"
)
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
projectService
).
getProjects
();
verify
(
projectService
).
getProjects
();
}
}
@Test
@Test
public
void
testgetEmployeeRoleData
()
throws
Exception
{
public
void
testgetEmployeeRoleData
()
throws
Exception
{
EmployeeRoles
employeesRole
=
new
EmployeeRoles
(
"5976ef15874c902c98b8a05d"
,
"16127"
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
new
Date
(
2017
-
11
-
18
),
new
Date
(
2017
-
12
-
18
));
EmployeeRoles
employeesRole
=
new
EmployeeRoles
(
when
(
userService
.
getEmployeesRoleData
(
"16127"
)).
thenReturn
(
employeesRole
);
"5976ef15874c902c98b8a05d"
,
"16127"
,
null
,
null
,
null
,
null
,
mockMvc
.
perform
(
get
(
"/project/getEmployeeRoleData"
).
param
(
"empId"
,
"16127"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
new
Date
(
2017
-
11
-
18
),
new
Date
(
2017
-
12
-
18
));
when
(
userService
.
getEmployeesRoleData
(
"16127"
))
.
thenReturn
(
employeesRole
);
mockMvc
.
perform
(
get
(
"/project/getEmployeeRoleData"
).
param
(
"empId"
,
"16127"
)
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
getEmployeesRoleData
(
"16127"
);
verify
(
userService
).
getEmployeesRoleData
(
"16127"
);
}
}
private
List
<
Project
>
CreateProjectDetails
()
{
private
List
<
Project
>
CreateProjectDetails
()
{
List
<
Project
>
data
=
new
ArrayList
<>();
List
<
Project
>
data
=
new
ArrayList
<>();
...
@@ -132,7 +158,6 @@ public class ProjectControllerTest {
...
@@ -132,7 +158,6 @@ public class ProjectControllerTest {
list
.
add
(
"16103"
);
list
.
add
(
"16103"
);
data1
.
setEmployeeIds
(
list
);
data1
.
setEmployeeIds
(
list
);
Project
data2
=
new
Project
();
Project
data2
=
new
Project
();
data2
.
setId
(
new
ObjectId
(
"9976ef15874c902c98b8a05d"
));
data2
.
setId
(
new
ObjectId
(
"9976ef15874c902c98b8a05d"
));
data2
.
setProjectId
(
"102"
);
data2
.
setProjectId
(
"102"
);
...
...
src/test/java/com/nisum/mytime/controllertest/ProjectTeamControllerTest.java
View file @
963f6644
...
@@ -6,9 +6,11 @@ import static org.mockito.Mockito.when;
...
@@ -6,9 +6,11 @@ import static org.mockito.Mockito.when;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
request
.
MockMvcRequestBuilders
.
delete
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
request
.
MockMvcRequestBuilders
.
delete
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
request
.
MockMvcRequestBuilders
.
get
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
request
.
MockMvcRequestBuilders
.
get
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
request
.
MockMvcRequestBuilders
.
post
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
request
.
MockMvcRequestBuilders
.
post
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
org.bson.types.ObjectId
;
import
org.bson.types.ObjectId
;
import
org.junit.Before
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.junit.Test
;
...
@@ -19,6 +21,7 @@ import org.springframework.http.MediaType;
...
@@ -19,6 +21,7 @@ import org.springframework.http.MediaType;
import
org.springframework.test.web.servlet.MockMvc
;
import
org.springframework.test.web.servlet.MockMvc
;
import
org.springframework.test.web.servlet.result.MockMvcResultMatchers
;
import
org.springframework.test.web.servlet.result.MockMvcResultMatchers
;
import
org.springframework.test.web.servlet.setup.MockMvcBuilders
;
import
org.springframework.test.web.servlet.setup.MockMvcBuilders
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.nisum.mytime.controller.ProjectTeamController
;
import
com.nisum.mytime.controller.ProjectTeamController
;
import
com.nisum.mytime.model.EmployeeRoles
;
import
com.nisum.mytime.model.EmployeeRoles
;
...
@@ -44,15 +47,20 @@ public class ProjectTeamControllerTest {
...
@@ -44,15 +47,20 @@ public class ProjectTeamControllerTest {
@Before
@Before
public
void
setup
()
{
public
void
setup
()
{
MockitoAnnotations
.
initMocks
(
this
);
MockitoAnnotations
.
initMocks
(
this
);
mockMvc
=
MockMvcBuilders
.
standaloneSetup
(
projectTeamController
).
build
();
mockMvc
=
MockMvcBuilders
.
standaloneSetup
(
projectTeamController
)
.
build
();
}
}
@Test
@Test
public
void
testgetEmployeeRole
()
throws
Exception
{
public
void
testgetEmployeeRole
()
throws
Exception
{
EmployeeRoles
employeesRole
=
new
EmployeeRoles
(
"5976ef15874c902c98b8a05d"
,
null
,
null
,
null
,
null
,
null
,
null
,
EmployeeRoles
employeesRole
=
new
EmployeeRoles
(
null
,
null
,
"user@nisum.com"
,
null
,
null
,
null
,
new
Date
(
2017
-
11
-
20
),
new
Date
(
2107
-
12
-
23
));
"5976ef15874c902c98b8a05d"
,
null
,
null
,
null
,
null
,
null
,
null
,
when
(
userService
.
getEmployeesRole
(
"user@nisum.com"
)).
thenReturn
(
employeesRole
);
null
,
null
,
null
,
null
,
null
,
null
,
"user@nisum.com"
,
null
,
mockMvc
.
perform
(
get
(
"/projectTeam/employee"
).
param
(
"emailId"
,
"user@nisum.com"
))
null
,
null
,
new
Date
(
2017
-
11
-
20
),
new
Date
(
2107
-
12
-
23
));
when
(
userService
.
getEmployeesRole
(
"user@nisum.com"
))
.
thenReturn
(
employeesRole
);
mockMvc
.
perform
(
get
(
"/projectTeam/employee"
).
param
(
"emailId"
,
"user@nisum.com"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
getEmployeesRole
(
"user@nisum.com"
);
verify
(
userService
).
getEmployeesRole
(
"user@nisum.com"
);
}
}
...
@@ -63,42 +71,57 @@ public class ProjectTeamControllerTest {
...
@@ -63,42 +71,57 @@ public class ProjectTeamControllerTest {
list
.
add
(
"16101"
);
list
.
add
(
"16101"
);
list
.
add
(
"16102"
);
list
.
add
(
"16102"
);
list
.
add
(
"16103"
);
list
.
add
(
"16103"
);
Project
employeeRole1
=
new
Project
(
new
ObjectId
(
"9976ef15874c902c98b8a05d"
),
"102"
,
"OMS"
,
"16101"
,
"Srikanth"
,
Project
employeeRole1
=
new
Project
(
"Gap"
,
"Billable"
,
list
);
new
ObjectId
(
"9976ef15874c902c98b8a05d"
),
"102"
,
"OMS"
,
"16101"
,
String
jsonvalue
=
(
new
ObjectMapper
()).
writeValueAsString
(
employeeRole1
).
toString
();
"Srikanth"
,
"Gap"
,
"Billable"
,
list
);
when
(
projectService
.
addProject
(
employeeRole1
)).
thenReturn
(
employeeRole1
);
String
jsonvalue
=
(
new
ObjectMapper
())
mockMvc
.
perform
(
.
writeValueAsString
(
employeeRole1
).
toString
();
post
(
"/projectTeam/addProject"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
).
content
(
jsonvalue
))
when
(
projectService
.
addProject
(
employeeRole1
))
.
thenReturn
(
employeeRole1
);
mockMvc
.
perform
(
post
(
"/projectTeam/addProject"
)
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)
.
content
(
jsonvalue
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
}
}
@Test
@Test
public
void
testupdateEmployeeRole
()
throws
Exception
{
public
void
testupdateEmployeeRole
()
throws
Exception
{
EmployeeRoles
employeesRoles2
=
new
EmployeeRoles
(
"1976ef15874c902c98b8a05d"
,
"16111"
,
"Vinay Singh"
,
EmployeeRoles
employeesRoles2
=
new
EmployeeRoles
(
"vsingh@nisum.com"
,
"Manager"
,
null
,
"09:00-06:00"
,
"Java/J2EE"
,
"Testing"
,
"8755672341"
,
"8800543678"
,
"1976ef15874c902c98b8a05d"
,
"16111"
,
"Vinay Singh"
,
"vsingh@gmail.com"
,
null
,
new
Date
(
2017
-
11
-
29
),
new
Date
(
2017
-
12
-
20
));
"vsingh@nisum.com"
,
"Manager"
,
null
,
"09:00-06:00"
,
"Java/J2EE"
,
"Testing"
,
"8755672341"
,
"8800543678"
,
"vsingh@gmail.com"
,
null
,
null
,
null
,
null
,
null
,
new
Date
(
2017
-
11
-
29
),
new
Date
(
2017
-
12
-
20
));
ObjectMapper
mapper
=
new
ObjectMapper
();
ObjectMapper
mapper
=
new
ObjectMapper
();
String
jsonString
=
mapper
.
writeValueAsString
(
employeesRoles2
);
String
jsonString
=
mapper
.
writeValueAsString
(
employeesRoles2
);
when
(
userService
.
updateEmployeeRole
(
any
())).
thenReturn
(
employeesRoles2
);
when
(
userService
.
updateEmployeeRole
(
any
())).
thenReturn
(
employeesRoles2
);
mockMvc
.
perform
(
post
(
"/projectTeam/updateEmployeeRole"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)
mockMvc
.
perform
(
post
(
"/projectTeam/updateEmployeeRole"
)
.
content
(
jsonString
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)
.
content
(
jsonString
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
updateEmployeeRole
(
any
());
verify
(
userService
).
updateEmployeeRole
(
any
());
}
}
@Test
@Test
public
void
testdeleteEmployee
()
throws
Exception
{
public
void
testdeleteEmployee
()
throws
Exception
{
mockMvc
.
perform
(
delete
(
"/projectTeam/deleteEmployee"
).
param
(
"empId"
,
"16157"
))
mockMvc
.
perform
(
delete
(
"/projectTeam/deleteEmployee"
).
param
(
"empId"
,
"16157"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
deleteEmployee
(
"16157"
);
verify
(
userService
).
deleteEmployee
(
"16157"
);
}
}
@Test
@Test
public
void
testgetEmployeeRoleData
()
throws
Exception
{
public
void
testgetEmployeeRoleData
()
throws
Exception
{
EmployeeRoles
employeesRole
=
new
EmployeeRoles
(
"5976ef15874c902c98b8a05d"
,
"16127"
,
null
,
null
,
null
,
null
,
EmployeeRoles
employeesRole
=
new
EmployeeRoles
(
null
,
null
,
null
,
null
,
null
,
null
,
null
,
new
Date
(
2017
-
11
-
20
),
new
Date
(
2107
-
12
-
23
));
"5976ef15874c902c98b8a05d"
,
"16127"
,
null
,
null
,
null
,
null
,
when
(
userService
.
getEmployeesRoleData
(
"16127"
)).
thenReturn
(
employeesRole
);
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
mockMvc
.
perform
(
get
(
"/projectTeam/getEmployeeRoleData"
).
param
(
"empId"
,
"16127"
)
null
,
new
Date
(
2017
-
11
-
20
),
new
Date
(
2107
-
12
-
23
));
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
when
(
userService
.
getEmployeesRoleData
(
"16127"
))
.
thenReturn
(
employeesRole
);
mockMvc
.
perform
(
get
(
"/projectTeam/getEmployeeRoleData"
).
param
(
"empId"
,
"16127"
)
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
getEmployeesRoleData
(
"16127"
);
verify
(
userService
).
getEmployeesRoleData
(
"16127"
);
}
}
...
@@ -106,7 +129,8 @@ public class ProjectTeamControllerTest {
...
@@ -106,7 +129,8 @@ public class ProjectTeamControllerTest {
public
void
testgetManagers
()
throws
Exception
{
public
void
testgetManagers
()
throws
Exception
{
List
<
EmployeeRoles
>
employeesRoles
=
createEmployeeRoles
();
List
<
EmployeeRoles
>
employeesRoles
=
createEmployeeRoles
();
when
(
userService
.
getEmployeeRoles
()).
thenReturn
(
employeesRoles
);
when
(
userService
.
getEmployeeRoles
()).
thenReturn
(
employeesRoles
);
mockMvc
.
perform
(
get
(
"/projectTeam/getEmployeesToTeam"
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
mockMvc
.
perform
(
get
(
"/projectTeam/getEmployeesToTeam"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
}
}
...
@@ -114,52 +138,72 @@ public class ProjectTeamControllerTest {
...
@@ -114,52 +138,72 @@ public class ProjectTeamControllerTest {
public
void
testgetTeamDetails
()
throws
Exception
{
public
void
testgetTeamDetails
()
throws
Exception
{
List
<
ProjectTeamMate
>
employeesRoles
=
createProjectTeamMate
();
List
<
ProjectTeamMate
>
employeesRoles
=
createProjectTeamMate
();
when
(
projectService
.
getTeamDetails
(
"16127"
)).
thenReturn
(
employeesRoles
);
when
(
projectService
.
getTeamDetails
(
"16127"
)).
thenReturn
(
employeesRoles
);
mockMvc
.
perform
(
get
(
"/projectTeam/getTeamDetails"
).
param
(
"employeeId"
,
"16127"
))
mockMvc
.
perform
(
get
(
"/projectTeam/getTeamDetails"
).
param
(
"employeeId"
,
"16127"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
projectService
).
getTeamDetails
(
"16127"
);
verify
(
projectService
).
getTeamDetails
(
"16127"
);
}
}
@Test
@Test
public
void
testaddEmployeeToTeam
()
throws
Exception
{
public
void
testaddEmployeeToTeam
()
throws
Exception
{
ProjectTeamMate
projectTeamMate
=
new
ProjectTeamMate
(
new
ObjectId
(
"1976ef15874c902c98b8a05d"
),
"16127"
,
ProjectTeamMate
projectTeamMate
=
new
ProjectTeamMate
(
"Monika Srivastava"
,
"msrivastava@nisum.com"
,
"Employee"
,
"09:00-06:00"
,
"101"
,
"MOSAIC"
,
"GAP"
,
new
ObjectId
(
"1976ef15874c902c98b8a05d"
),
"16127"
,
"16081"
,
"Rajeshekar"
,
"01"
,
"Software Engineer"
,
"Non-Billable"
,
"8765588388"
,
new
Date
(),
new
Date
(),
true
);
"Monika Srivastava"
,
"msrivastava@nisum.com"
,
"Employee"
,
String
jsonvalue
=
(
new
ObjectMapper
()).
writeValueAsString
(
projectTeamMate
).
toString
();
"09:00-06:00"
,
"101"
,
"MOSAIC"
,
"GAP"
,
"16081"
,
"Rajeshekar"
,
when
(
projectService
.
addProjectTeamMate
(
projectTeamMate
)).
thenReturn
(
projectTeamMate
);
"01"
,
"Software Engineer"
,
"Non-Billable"
,
"8765588388"
,
mockMvc
.
perform
(
new
Date
(),
new
Date
(),
true
);
post
(
"/projectTeam/addEmployeeToTeam"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
).
content
(
jsonvalue
))
String
jsonvalue
=
(
new
ObjectMapper
())
.
writeValueAsString
(
projectTeamMate
).
toString
();
when
(
projectService
.
addProjectTeamMate
(
projectTeamMate
))
.
thenReturn
(
projectTeamMate
);
mockMvc
.
perform
(
post
(
"/projectTeam/addEmployeeToTeam"
)
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)
.
content
(
jsonvalue
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
}
}
@Test
@Test
public
void
testupdateTeammate
()
throws
Exception
{
public
void
testupdateTeammate
()
throws
Exception
{
ProjectTeamMate
updatedTeammate
=
new
ProjectTeamMate
(
new
ObjectId
(
"1976ef15874c902c98b8a05d"
),
"16127"
,
ProjectTeamMate
updatedTeammate
=
new
ProjectTeamMate
(
"Monika Srivastava"
,
"msrivastava@nisum.com"
,
"Employee"
,
"09:00-06:00"
,
"101"
,
"MOSAIC"
,
"GAP"
,
new
ObjectId
(
"1976ef15874c902c98b8a05d"
),
"16127"
,
"16081"
,
"Rajeshekar"
,
"01"
,
"Software Engineer"
,
"Non-Billable"
,
"8765588388"
,
new
Date
(),
new
Date
(),
true
);
"Monika Srivastava"
,
"msrivastava@nisum.com"
,
"Employee"
,
String
jsonvalue
=
(
new
ObjectMapper
()).
writeValueAsString
(
updatedTeammate
).
toString
();
"09:00-06:00"
,
"101"
,
"MOSAIC"
,
"GAP"
,
"16081"
,
"Rajeshekar"
,
when
(
projectService
.
updateTeammate
(
updatedTeammate
)).
thenReturn
(
updatedTeammate
);
"01"
,
"Software Engineer"
,
"Non-Billable"
,
"8765588388"
,
mockMvc
.
perform
(
new
Date
(),
new
Date
(),
true
);
post
(
"/projectTeam/updateTeammate"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
).
content
(
jsonvalue
))
String
jsonvalue
=
(
new
ObjectMapper
())
.
writeValueAsString
(
updatedTeammate
).
toString
();
when
(
projectService
.
updateTeammate
(
updatedTeammate
))
.
thenReturn
(
updatedTeammate
);
mockMvc
.
perform
(
post
(
"/projectTeam/updateTeammate"
)
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)
.
content
(
jsonvalue
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
}
}
@Test
@Test
public
void
testdeleteTeammate
()
throws
Exception
{
public
void
testdeleteTeammate
()
throws
Exception
{
ProjectTeamMate
deleteTeamMate
=
new
ProjectTeamMate
(
new
ObjectId
(
"1976ef15874c902c98b8a05d"
),
"16127"
,
ProjectTeamMate
deleteTeamMate
=
new
ProjectTeamMate
(
"Monika Srivastava"
,
"msrivastava@nisum.com"
,
"Employee"
,
"09:00-06:00"
,
"101"
,
"MOSAIC"
,
"GAP"
,
new
ObjectId
(
"1976ef15874c902c98b8a05d"
),
"16127"
,
"16081"
,
"Rajeshekar"
,
"01"
,
"Software Engineer"
,
"Non-Billable"
,
"8765588388"
,
new
Date
(),
new
Date
(),
true
);
"Monika Srivastava"
,
"msrivastava@nisum.com"
,
"Employee"
,
String
jsonvalue
=
(
new
ObjectMapper
()).
writeValueAsString
(
deleteTeamMate
).
toString
();
"09:00-06:00"
,
"101"
,
"MOSAIC"
,
"GAP"
,
"16081"
,
"Rajeshekar"
,
mockMvc
.
perform
(
"01"
,
"Software Engineer"
,
"Non-Billable"
,
"8765588388"
,
post
(
"/projectTeam/deleteTeammate"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
).
content
(
jsonvalue
))
new
Date
(),
new
Date
(),
true
);
String
jsonvalue
=
(
new
ObjectMapper
())
.
writeValueAsString
(
deleteTeamMate
).
toString
();
mockMvc
.
perform
(
post
(
"/projectTeam/deleteTeammate"
)
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)
.
content
(
jsonvalue
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
projectService
).
deleteTeammate
(
"16127"
,
"101"
,
new
ObjectId
(
"1976ef15874c902c98b8a05d"
));
verify
(
projectService
).
deleteTeammate
(
"16127"
,
"101"
,
new
ObjectId
(
"1976ef15874c902c98b8a05d"
));
}
}
@Test
@Test
public
void
testgetProjects
()
throws
Exception
{
public
void
testgetProjects
()
throws
Exception
{
List
<
Project
>
projects
=
CreateProjectDetails
();
List
<
Project
>
projects
=
CreateProjectDetails
();
when
(
projectService
.
getProjects
(
"16127"
)).
thenReturn
(
projects
);
when
(
projectService
.
getProjects
(
"16127"
)).
thenReturn
(
projects
);
mockMvc
.
perform
(
get
(
"/projectTeam/getProjects"
).
param
(
"employeeId"
,
"16127"
))
mockMvc
.
perform
(
get
(
"/projectTeam/getProjects"
).
param
(
"employeeId"
,
"16127"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
projectService
).
getProjects
(
"16127"
);
verify
(
projectService
).
getProjects
(
"16127"
);
}
}
...
@@ -167,25 +211,30 @@ public class ProjectTeamControllerTest {
...
@@ -167,25 +211,30 @@ public class ProjectTeamControllerTest {
@Test
@Test
public
void
testgetMyTeamDetails
()
throws
Exception
{
public
void
testgetMyTeamDetails
()
throws
Exception
{
List
<
ProjectTeamMate
>
employeesRoles
=
createProjectTeamMate
();
List
<
ProjectTeamMate
>
employeesRoles
=
createProjectTeamMate
();
when
(
projectService
.
getMyTeamDetails
(
"16127"
)).
thenReturn
(
employeesRoles
);
when
(
projectService
.
getMyTeamDetails
(
"16127"
))
mockMvc
.
perform
(
get
(
"/projectTeam/getMyTeamDetails"
).
param
(
"employeeId"
,
"16127"
))
.
thenReturn
(
employeesRoles
);
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
mockMvc
.
perform
(
get
(
"/projectTeam/getMyTeamDetails"
).
param
(
"employeeId"
,
"16127"
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
projectService
).
getMyTeamDetails
(
"16127"
);
verify
(
projectService
).
getMyTeamDetails
(
"16127"
);
}
}
@Test
@Test
public
void
testgetUnAssignedEmployees
()
throws
Exception
{
public
void
testgetUnAssignedEmployees
()
throws
Exception
{
List
<
EmployeeRoles
>
employeesRoles
=
createEmployeeRoles
();
List
<
EmployeeRoles
>
employeesRoles
=
createEmployeeRoles
();
when
(
projectService
.
getUnAssignedEmployees
()).
thenReturn
(
employeesRoles
);
when
(
projectService
.
getUnAssignedEmployees
())
mockMvc
.
perform
(
get
(
"/projectTeam/getUnAssignedEmployees"
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
.
thenReturn
(
employeesRoles
);
mockMvc
.
perform
(
get
(
"/projectTeam/getUnAssignedEmployees"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
projectService
).
getUnAssignedEmployees
();
verify
(
projectService
).
getUnAssignedEmployees
();
}
}
@Test
@Test
public
void
testgetShiftDetails
()
throws
Exception
{
public
void
testgetShiftDetails
()
throws
Exception
{
List
<
ProjectTeamMate
>
employeesRoles
=
createProjectTeamMate
();
List
<
ProjectTeamMate
>
employeesRoles
=
createProjectTeamMate
();
when
(
projectService
.
getShiftDetails
(
"09:00-06:00"
)).
thenReturn
(
employeesRoles
);
when
(
projectService
.
getShiftDetails
(
"09:00-06:00"
))
mockMvc
.
perform
(
get
(
"/projectTeam/getShiftDetails"
).
param
(
"shift"
,
"09:00-06:00"
))
.
thenReturn
(
employeesRoles
);
mockMvc
.
perform
(
get
(
"/projectTeam/getShiftDetails"
).
param
(
"shift"
,
"09:00-06:00"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
projectService
).
getShiftDetails
(
"09:00-06:00"
);
verify
(
projectService
).
getShiftDetails
(
"09:00-06:00"
);
}
}
...
@@ -194,34 +243,42 @@ public class ProjectTeamControllerTest {
...
@@ -194,34 +243,42 @@ public class ProjectTeamControllerTest {
public
void
testgetProjectAllocations
()
throws
Exception
{
public
void
testgetProjectAllocations
()
throws
Exception
{
List
<
ProjectTeamMate
>
employeesRoles
=
createProjectTeamMate
();
List
<
ProjectTeamMate
>
employeesRoles
=
createProjectTeamMate
();
when
(
projectService
.
getAllProjectDetails
()).
thenReturn
(
employeesRoles
);
when
(
projectService
.
getAllProjectDetails
()).
thenReturn
(
employeesRoles
);
mockMvc
.
perform
(
get
(
"/projectTeam/getProjectAllocations"
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
mockMvc
.
perform
(
get
(
"/projectTeam/getProjectAllocations"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
projectService
).
getAllProjectDetails
();
verify
(
projectService
).
getAllProjectDetails
();
}
}
@Test
@Test
public
void
testgetProjectDetails
()
throws
Exception
{
public
void
testgetProjectDetails
()
throws
Exception
{
List
<
ProjectTeamMate
>
employeesRoles
=
createProjectTeamMate
();
List
<
ProjectTeamMate
>
employeesRoles
=
createProjectTeamMate
();
when
(
projectService
.
getProjectDetails
(
"101"
)).
thenReturn
(
employeesRoles
);
when
(
projectService
.
getProjectDetails
(
"101"
))
mockMvc
.
perform
(
get
(
"/projectTeam/getProjectDetails"
).
param
(
"projectId"
,
"101"
))
.
thenReturn
(
employeesRoles
);
mockMvc
.
perform
(
get
(
"/projectTeam/getProjectDetails"
).
param
(
"projectId"
,
"101"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
projectService
).
getProjectDetails
(
"101"
);
verify
(
projectService
).
getProjectDetails
(
"101"
);
}
}
@Test
@Test
public
void
testgetMyProjectAllocations
()
throws
Exception
{
public
void
testgetMyProjectAllocations
()
throws
Exception
{
List
<
ProjectTeamMate
>
projectAllocations
=
createProjectTeamMate
();
List
<
ProjectTeamMate
>
projectAllocations
=
createProjectTeamMate
();
System
.
out
.
println
(
projectAllocations
);
System
.
out
.
println
(
projectAllocations
);
when
(
projectService
.
getMyProjectAllocations
(
"16127"
)).
thenReturn
(
projectAllocations
);
when
(
projectService
.
getMyProjectAllocations
(
"16127"
))
mockMvc
.
perform
(
get
(
"/projectTeam/getMyProjectAllocations"
).
param
(
"employeeId"
,
"16127"
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
.
thenReturn
(
projectAllocations
);
mockMvc
.
perform
(
get
(
"/projectTeam/getMyProjectAllocations"
)
.
param
(
"employeeId"
,
"16127"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
projectService
).
getMyProjectAllocations
(
"16127"
);
verify
(
projectService
).
getMyProjectAllocations
(
"16127"
);
}
}
@Test
@Test
public
void
testgetEmployeeBillingDetails
()
throws
Exception
{
public
void
testgetEmployeeBillingDetails
()
throws
Exception
{
List
<
TeamMateBilling
>
billings
=
CreateTeamMateBilling
();
List
<
TeamMateBilling
>
billings
=
CreateTeamMateBilling
();
System
.
out
.
println
(
billings
);
System
.
out
.
println
(
billings
);
when
(
projectService
.
getEmployeeBillingDetails
(
"16127"
,
"101"
)).
thenReturn
(
billings
);
when
(
projectService
.
getEmployeeBillingDetails
(
"16127"
,
"101"
))
mockMvc
.
perform
(
get
(
"/projectTeam/getEmployeeBillingDetails"
).
param
(
"employeeId"
,
"16127"
).
param
(
"projectId"
,
"101"
))
.
thenReturn
(
billings
);
mockMvc
.
perform
(
get
(
"/projectTeam/getEmployeeBillingDetails"
)
.
param
(
"employeeId"
,
"16127"
).
param
(
"projectId"
,
"101"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
projectService
).
getEmployeeBillingDetails
(
"16127"
,
"101"
);
verify
(
projectService
).
getEmployeeBillingDetails
(
"16127"
,
"101"
);
}
}
...
@@ -235,8 +292,8 @@ public class ProjectTeamControllerTest {
...
@@ -235,8 +292,8 @@ public class ProjectTeamControllerTest {
team1
.
setEmployeeName
(
"Employee1"
);
team1
.
setEmployeeName
(
"Employee1"
);
team1
.
setProjectId
(
"101"
);
team1
.
setProjectId
(
"101"
);
team1
.
setProjectName
(
"MOSAIC"
);
team1
.
setProjectName
(
"MOSAIC"
);
team1
.
setBillingStartDate
(
new
Date
(
2017
-
01
-
10
));
team1
.
setBillingStartDate
(
new
Date
(
2017
-
01
-
10
));
team1
.
setBillingEndDate
(
new
Date
(
2017
-
02
-
10
));
team1
.
setBillingEndDate
(
new
Date
(
2017
-
02
-
10
));
team1
.
setActive
(
true
);
team1
.
setActive
(
true
);
data
.
add
(
team1
);
data
.
add
(
team1
);
...
@@ -246,8 +303,8 @@ public class ProjectTeamControllerTest {
...
@@ -246,8 +303,8 @@ public class ProjectTeamControllerTest {
team2
.
setEmployeeName
(
"Employee2"
);
team2
.
setEmployeeName
(
"Employee2"
);
team2
.
setProjectId
(
"102"
);
team2
.
setProjectId
(
"102"
);
team2
.
setProjectName
(
"OMS"
);
team2
.
setProjectName
(
"OMS"
);
team2
.
setBillingStartDate
(
new
Date
(
2017
-
01
-
15
));
team2
.
setBillingStartDate
(
new
Date
(
2017
-
01
-
15
));
team2
.
setBillingEndDate
(
new
Date
(
2017
-
02
-
15
));
team2
.
setBillingEndDate
(
new
Date
(
2017
-
02
-
15
));
team2
.
setActive
(
false
);
team2
.
setActive
(
false
);
data
.
add
(
team2
);
data
.
add
(
team2
);
...
...
src/test/java/com/nisum/mytime/controllertest/UserControllerTest.java
View file @
963f6644
...
@@ -9,9 +9,11 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder
...
@@ -9,9 +9,11 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder
import
static
org
.
springframework
.
test
.
web
.
servlet
.
request
.
MockMvcRequestBuilders
.
post
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
request
.
MockMvcRequestBuilders
.
post
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
result
.
MockMvcResultHandlers
.
print
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
result
.
MockMvcResultHandlers
.
print
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
result
.
MockMvcResultMatchers
.
jsonPath
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
result
.
MockMvcResultMatchers
.
jsonPath
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
org.bson.types.ObjectId
;
import
org.bson.types.ObjectId
;
import
org.junit.Before
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.junit.Test
;
...
@@ -22,6 +24,7 @@ import org.springframework.http.MediaType;
...
@@ -22,6 +24,7 @@ import org.springframework.http.MediaType;
import
org.springframework.test.web.servlet.MockMvc
;
import
org.springframework.test.web.servlet.MockMvc
;
import
org.springframework.test.web.servlet.result.MockMvcResultMatchers
;
import
org.springframework.test.web.servlet.result.MockMvcResultMatchers
;
import
org.springframework.test.web.servlet.setup.MockMvcBuilders
;
import
org.springframework.test.web.servlet.setup.MockMvcBuilders
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.nisum.mytime.controller.UserController
;
import
com.nisum.mytime.controller.UserController
;
import
com.nisum.mytime.model.Account
;
import
com.nisum.mytime.model.Account
;
...
@@ -49,37 +52,52 @@ public class UserControllerTest {
...
@@ -49,37 +52,52 @@ public class UserControllerTest {
@Test
@Test
public
void
testgetEmployeeRole
()
throws
Exception
{
public
void
testgetEmployeeRole
()
throws
Exception
{
EmployeeRoles
employeesRole
=
new
EmployeeRoles
(
"5976ef15874c902c98b8a05d"
,
null
,
null
,
EmployeeRoles
employeesRole
=
new
EmployeeRoles
(
"user@nisum.com"
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
new
Date
(
2017
-
11
-
20
),
new
Date
(
2017
-
12
-
23
));
"5976ef15874c902c98b8a05d"
,
null
,
null
,
"user@nisum.com"
,
null
,
when
(
userService
.
getEmployeesRole
(
"user@nisum.com"
)).
thenReturn
(
employeesRole
);
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
mockMvc
.
perform
(
get
(
"/user/employee"
).
param
(
"emailId"
,
"user@nisum.com"
))
null
,
null
,
new
Date
(
2017
-
11
-
20
),
new
Date
(
2017
-
12
-
23
));
when
(
userService
.
getEmployeesRole
(
"user@nisum.com"
))
.
thenReturn
(
employeesRole
);
mockMvc
.
perform
(
get
(
"/user/employee"
).
param
(
"emailId"
,
"user@nisum.com"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
getEmployeesRole
(
"user@nisum.com"
);
verify
(
userService
).
getEmployeesRole
(
"user@nisum.com"
);
}
}
@Test
@Test
public
void
testassigingEmployeeRole
()
throws
Exception
{
public
void
testassigingEmployeeRole
()
throws
Exception
{
EmployeeRoles
employeeRole
=
new
EmployeeRoles
(
"5976ef15874c902c98b8a05c"
,
"16135"
,
"Monika"
,
EmployeeRoles
employeeRole
=
new
EmployeeRoles
(
"user1@nisum.com"
,
"HR"
,
"Human Resource Lead"
,
"06:00-09:00"
,
"Java/J2EE"
,
"Spring"
,
"8767893452"
,
"5687234567"
,
"user1@gmail.com"
,
null
,
new
Date
(
2017
-
11
-
20
),
new
Date
(
2017
-
12
-
23
));
"5976ef15874c902c98b8a05c"
,
"16135"
,
"Monika"
,
"user1@nisum.com"
,
"HR"
,
"Human Resource Lead"
,
"06:00-09:00"
,
"Java/J2EE"
,
"Spring"
,
"8767893452"
,
"5687234567"
,
"user1@gmail.com"
,
null
,
null
,
null
,
null
,
null
,
new
Date
(
2017
-
11
-
20
),
new
Date
(
2017
-
12
-
23
));
ObjectMapper
mapper
=
new
ObjectMapper
();
ObjectMapper
mapper
=
new
ObjectMapper
();
String
jsonString
=
mapper
.
writeValueAsString
(
employeeRole
);
String
jsonString
=
mapper
.
writeValueAsString
(
employeeRole
);
when
(
userService
.
assigingEmployeeRole
(
anyObject
())).
thenReturn
(
employeeRole
);
when
(
userService
.
assigingEmployeeRole
(
anyObject
()))
mockMvc
.
perform
(
.
thenReturn
(
employeeRole
);
post
(
"/user/assignEmployeeRole"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
).
content
(
jsonString
))
mockMvc
.
perform
(
post
(
"/user/assignEmployeeRole"
)
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)
.
content
(
jsonString
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
assigingEmployeeRole
(
anyObject
());
verify
(
userService
).
assigingEmployeeRole
(
anyObject
());
}
}
@Test
@Test
public
void
testupdateEmployeeRole
()
throws
Exception
{
public
void
testupdateEmployeeRole
()
throws
Exception
{
EmployeeRoles
employeeRole2
=
new
EmployeeRoles
(
"5976ef15874c902c98b8a05d"
,
"67890"
,
"Sonika"
,
EmployeeRoles
employeeRole2
=
new
EmployeeRoles
(
"user2@nisum.com"
,
"Manager"
,
"Senior Software Engineer"
,
"09:00am-06:00am"
,
"php"
,
"Hibernate"
,
"9878678956"
,
"9989782210"
,
"user2@gmail.com"
,
null
,
new
Date
(
2017
-
11
-
20
),
new
Date
(
2017
-
12
-
23
));
"5976ef15874c902c98b8a05d"
,
"67890"
,
"Sonika"
,
"user2@nisum.com"
,
"Manager"
,
"Senior Software Engineer"
,
"09:00am-06:00am"
,
"php"
,
"Hibernate"
,
"9878678956"
,
"9989782210"
,
"user2@gmail.com"
,
null
,
null
,
null
,
null
,
null
,
new
Date
(
2017
-
11
-
20
),
new
Date
(
2017
-
12
-
23
));
ObjectMapper
mapper
=
new
ObjectMapper
();
ObjectMapper
mapper
=
new
ObjectMapper
();
String
jsonString
=
mapper
.
writeValueAsString
(
employeeRole2
);
String
jsonString
=
mapper
.
writeValueAsString
(
employeeRole2
);
when
(
userService
.
updateEmployeeRole
(
anyObject
())).
thenReturn
(
employeeRole2
);
when
(
userService
.
updateEmployeeRole
(
anyObject
()))
mockMvc
.
perform
(
.
thenReturn
(
employeeRole2
);
post
(
"/user/updateEmployeeRole"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
).
content
(
jsonString
))
mockMvc
.
perform
(
post
(
"/user/updateEmployeeRole"
)
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)
.
content
(
jsonString
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
updateEmployeeRole
(
anyObject
());
verify
(
userService
).
updateEmployeeRole
(
anyObject
());
}
}
...
@@ -95,57 +113,92 @@ public class UserControllerTest {
...
@@ -95,57 +113,92 @@ public class UserControllerTest {
public
void
testgetUserRoles
()
throws
Exception
{
public
void
testgetUserRoles
()
throws
Exception
{
List
<
EmployeeRoles
>
employeesRole3
=
CreateUserRoles
();
List
<
EmployeeRoles
>
employeesRole3
=
CreateUserRoles
();
when
(
userService
.
getEmployeeRoles
()).
thenReturn
(
employeesRole3
);
when
(
userService
.
getEmployeeRoles
()).
thenReturn
(
employeesRole3
);
mockMvc
.
perform
(
get
(
"/user/getUserRoles"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
mockMvc
.
perform
(
get
(
"/user/getUserRoles"
)
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
getEmployeeRoles
();
verify
(
userService
).
getEmployeeRoles
();
}
}
@Test
@Test
public
void
testgetEmployeeRoleData
()
throws
Exception
{
public
void
testgetEmployeeRoleData
()
throws
Exception
{
EmployeeRoles
employeesRole
=
new
EmployeeRoles
(
"5976ef15874c902c98b8a05d"
,
"16127"
,
null
,
null
,
null
,
EmployeeRoles
employeesRole
=
new
EmployeeRoles
(
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
new
Date
(
2017
-
11
-
13
),
new
Date
(
2017
-
12
-
20
));
"5976ef15874c902c98b8a05d"
,
"16127"
,
null
,
null
,
null
,
null
,
when
(
userService
.
getEmployeesRoleData
(
"16127"
)).
thenReturn
(
employeesRole
);
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
mockMvc
.
perform
(
get
(
"/user/getEmployeeRoleData"
).
param
(
"empId"
,
"16127"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
null
,
new
Date
(
2017
-
11
-
13
),
new
Date
(
2017
-
12
-
20
));
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
()).
andExpect
(
jsonPath
(
"$.employeeId"
,
is
(
"16127"
)))
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
());
.
andDo
(
print
());
verify
(
userService
).
getEmployeesRoleData
(
"16127"
);
verify
(
userService
).
getEmployeesRoleData
(
"16127"
);
}
}
@Test
@Test
public
void
testgetEmployeeRoleDataForEmailIdSearch
()
throws
Exception
{
public
void
testgetEmployeeRoleDataForEmailIdSearch
()
throws
Exception
{
EmployeeRoles
employeesRole
=
new
EmployeeRoles
(
"5976ef15874c902c98b8a05d"
,
"16209"
,
null
,
null
,
null
,
null
,
EmployeeRoles
employeesRole
=
new
EmployeeRoles
(
null
,
null
,
null
,
null
,
null
,
null
,
null
,
new
Date
(
2017
-
11
-
13
),
new
Date
(
2017
-
12
-
20
));
"5976ef15874c902c98b8a05d"
,
"16209"
,
null
,
null
,
null
,
null
,
when
(
userService
.
getEmployeeRoleDataForSearchCriteria
(
"dummy@nisum.com"
,
"emailId"
)).
thenReturn
(
employeesRole
);
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
mockMvc
.
perform
(
get
(
"/user/getEmployeeRoleDataForSearchCriteria"
).
param
(
"searchId"
,
"dummy@nisum.com"
)
null
,
new
Date
(
2017
-
11
-
13
),
new
Date
(
2017
-
12
-
20
));
.
param
(
"searchAttribute"
,
"emailId"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
when
(
userService
.
getEmployeeRoleDataForSearchCriteria
(
"dummy@nisum.com"
,
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
()).
andExpect
(
jsonPath
(
"$.employeeId"
,
is
(
"16209"
)))
"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
());
.
andDo
(
print
());
verify
(
userService
).
getEmployeeRoleDataForSearchCriteria
(
"dummy@nisum.com"
,
"emailId"
);
verify
(
userService
).
getEmployeeRoleDataForSearchCriteria
(
"dummy@nisum.com"
,
"emailId"
);
}
}
@Test
@Test
public
void
testgetEmployeeRoleDataForEmployeeNameSearch
()
throws
Exception
{
public
void
testgetEmployeeRoleDataForEmployeeNameSearch
()
EmployeeRoles
employeesRole
=
new
EmployeeRoles
(
"5976ef15874c902c98b8a05d"
,
"16209"
,
null
,
null
,
null
,
null
,
throws
Exception
{
null
,
null
,
null
,
null
,
null
,
null
,
null
,
new
Date
(
2017
-
11
-
13
),
new
Date
(
2017
-
12
-
20
));
EmployeeRoles
employeesRole
=
new
EmployeeRoles
(
when
(
userService
.
getEmployeeRoleDataForSearchCriteria
(
"Mahesh Kumar Gutam"
,
"employeeName"
)).
thenReturn
(
employeesRole
);
"5976ef15874c902c98b8a05d"
,
"16209"
,
null
,
null
,
null
,
null
,
mockMvc
.
perform
(
get
(
"/user/getEmployeeRoleDataForSearchCriteria"
).
param
(
"searchId"
,
"Mahesh Kumar Gutam"
)
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
.
param
(
"searchAttribute"
,
"employeeName"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
null
,
new
Date
(
2017
-
11
-
13
),
new
Date
(
2017
-
12
-
20
));
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
()).
andExpect
(
jsonPath
(
"$.employeeId"
,
is
(
"16209"
)))
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
());
.
andDo
(
print
());
verify
(
userService
).
getEmployeeRoleDataForSearchCriteria
(
"Mahesh Kumar Gutam"
,
"employeeName"
);
verify
(
userService
).
getEmployeeRoleDataForSearchCriteria
(
"Mahesh Kumar Gutam"
,
"employeeName"
);
}
}
@Test
@Test
public
void
testGetEmployeeDetailsForAutocomplete
()
throws
Exception
{
public
void
testGetEmployeeDetailsForAutocomplete
()
throws
Exception
{
List
<
String
>
details
=
new
ArrayList
<>();
List
<
String
>
details
=
new
ArrayList
<>();
details
.
add
(
"16294"
);
details
.
add
(
"Ashwin Kumar"
);
details
.
add
(
"kashwin@nisum.com"
);
details
.
add
(
"16294"
);
details
.
add
(
"16209"
);
details
.
add
(
"Mahesh Kumar Gutam"
);
details
.
add
(
"mgutam@nisum.com"
);
details
.
add
(
"Ashwin Kumar"
);
details
.
add
(
"16143"
);
details
.
add
(
"Ajay"
);
details
.
add
(
"ajayS@nisum.com"
);
details
.
add
(
"kashwin@nisum.com"
);
details
.
add
(
"16207"
);
details
.
add
(
"Sumith Kumar Lambu"
);
details
.
add
(
"slambu@nisum.com"
);
details
.
add
(
"16209"
);
details
.
add
(
"16111"
);
details
.
add
(
"Mahesh Mudrakolu"
);
details
.
add
(
"mmahesh@nisum.com"
);
details
.
add
(
"Mahesh Kumar Gutam"
);
when
(
userService
.
getEmployeeDetailsForAutocomplete
()).
thenReturn
(
details
);
details
.
add
(
"mgutam@nisum.com"
);
mockMvc
.
perform
(
get
(
"/user/getEmployeeDetailsForAutocomplete"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
details
.
add
(
"16143"
);
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
()).
andDo
(
print
());
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
();
verify
(
userService
).
getEmployeeDetailsForAutocomplete
();
}
}
...
@@ -154,60 +207,73 @@ public class UserControllerTest {
...
@@ -154,60 +207,73 @@ public class UserControllerTest {
List
<
EmployeeRoles
>
employeesRole4
=
CreateUserRoles
();
List
<
EmployeeRoles
>
employeesRole4
=
CreateUserRoles
();
System
.
out
.
println
(
employeesRole4
);
System
.
out
.
println
(
employeesRole4
);
when
(
userService
.
getEmployeeRoles
()).
thenReturn
(
employeesRole4
);
when
(
userService
.
getEmployeeRoles
()).
thenReturn
(
employeesRole4
);
mockMvc
.
perform
(
get
(
"/user/getManagers"
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
mockMvc
.
perform
(
get
(
"/user/getManagers"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
getEmployeeRoles
();
verify
(
userService
).
getEmployeeRoles
();
}
}
@Test
@Test
public
void
testgetAllShifts
()
throws
Exception
{
public
void
testgetAllShifts
()
throws
Exception
{
List
<
Shift
>
shifts
=
CreateShifts
();
List
<
Shift
>
shifts
=
CreateShifts
();
when
(
userService
.
getAllShifts
()).
thenReturn
(
shifts
);
when
(
userService
.
getAllShifts
()).
thenReturn
(
shifts
);
mockMvc
.
perform
(
get
(
"/user/getAllShifts"
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
mockMvc
.
perform
(
get
(
"/user/getAllShifts"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
getAllShifts
();
verify
(
userService
).
getAllShifts
();
}
}
@Test
@Test
public
void
testgetAllDesignations
()
throws
Exception
{
public
void
testgetAllDesignations
()
throws
Exception
{
List
<
Designation
>
designation
=
CreateDesignations
();
List
<
Designation
>
designation
=
CreateDesignations
();
when
(
userService
.
getAllDesignations
()).
thenReturn
(
designation
);
when
(
userService
.
getAllDesignations
()).
thenReturn
(
designation
);
mockMvc
.
perform
(
get
(
"/user/getAllDesignations"
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
mockMvc
.
perform
(
get
(
"/user/getAllDesignations"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
getAllDesignations
();
verify
(
userService
).
getAllDesignations
();
}
}
@Test
@Test
public
void
testgetTechnologies
()
throws
Exception
{
public
void
testgetTechnologies
()
throws
Exception
{
List
<
Skill
>
skills
=
CreateSkill
();
List
<
Skill
>
skills
=
CreateSkill
();
System
.
out
.
println
(
skills
);
System
.
out
.
println
(
skills
);
when
(
userService
.
getTechnologies
()).
thenReturn
(
skills
);
when
(
userService
.
getTechnologies
()).
thenReturn
(
skills
);
mockMvc
.
perform
(
get
(
"/user/getSkills"
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
mockMvc
.
perform
(
get
(
"/user/getSkills"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
getTechnologies
();
verify
(
userService
).
getTechnologies
();
}
}
@Test
@Test
public
void
testupdateProfile
()
throws
Exception
{
public
void
testupdateProfile
()
throws
Exception
{
EmployeeRoles
employeeRole
=
new
EmployeeRoles
(
"5996ef15874c902c98b8a05d"
,
"16127"
,
"Monika Srivastava"
,
"msrivastava@nisum.com"
,
"Employee"
,
"Software Engineer"
,
"09:00-06:00"
,
"Java/J2EE"
,
"Spring"
,
"8765588388"
,
"9978567723"
,
"msrivastava@gmail.com"
,
null
,
new
Date
(
2017
-
01
-
01
),
new
Date
(
2017
-
03
-
01
));
EmployeeRoles
employeeRole
=
new
EmployeeRoles
(
"5996ef15874c902c98b8a05d"
,
"16127"
,
"Monika Srivastava"
,
"msrivastava@nisum.com"
,
"Employee"
,
"Software Engineer"
,
"09:00-06:00"
,
"Java/J2EE"
,
"Spring"
,
"8765588388"
,
"9978567723"
,
"msrivastava@gmail.com"
,
null
,
null
,
null
,
null
,
null
,
new
Date
(
2017
-
01
-
01
),
new
Date
(
2017
-
03
-
01
));
System
.
out
.
println
(
employeeRole
);
System
.
out
.
println
(
employeeRole
);
ObjectMapper
mapper
=
new
ObjectMapper
();
ObjectMapper
mapper
=
new
ObjectMapper
();
String
jsonString
=
mapper
.
writeValueAsString
(
employeeRole
);
String
jsonString
=
mapper
.
writeValueAsString
(
employeeRole
);
System
.
out
.
println
(
jsonString
);
System
.
out
.
println
(
jsonString
);
when
(
userService
.
updateProfile
(
anyObject
())).
thenReturn
(
employeeRole
);
when
(
userService
.
updateProfile
(
anyObject
())).
thenReturn
(
employeeRole
);
mockMvc
.
perform
(
post
(
"/user/updateProfile"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
).
content
(
jsonString
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
mockMvc
.
perform
(
post
(
"/user/updateProfile"
)
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)
.
content
(
jsonString
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
updateProfile
(
anyObject
());
verify
(
userService
).
updateProfile
(
anyObject
());
}
}
@Test
@Test
public
void
getAccounts
()
throws
Exception
{
public
void
getAccounts
()
throws
Exception
{
List
<
Account
>
account
=
CreateAccount
();
List
<
Account
>
account
=
CreateAccount
();
System
.
out
.
println
(
account
);
System
.
out
.
println
(
account
);
when
(
userService
.
getAccounts
()).
thenReturn
(
account
);
when
(
userService
.
getAccounts
()).
thenReturn
(
account
);
mockMvc
.
perform
(
get
(
"/user/getAccounts"
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
mockMvc
.
perform
(
get
(
"/user/getAccounts"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
getAccounts
();
verify
(
userService
).
getAccounts
();
}
}
private
List
<
Account
>
CreateAccount
()
{
private
List
<
Account
>
CreateAccount
()
{
List
<
Account
>
data
=
new
ArrayList
<>();
List
<
Account
>
data
=
new
ArrayList
<>();
Account
account1
=
new
Account
();
Account
account1
=
new
Account
();
account1
.
setId
(
new
ObjectId
(
"5976ef15874c902c98b8a05d"
));
account1
.
setId
(
new
ObjectId
(
"5976ef15874c902c98b8a05d"
));
account1
.
setAccountId
(
"01"
);
account1
.
setAccountId
(
"01"
);
account1
.
setAccountName
(
"GAP"
);
account1
.
setAccountName
(
"GAP"
);
...
@@ -215,7 +281,7 @@ public class UserControllerTest {
...
@@ -215,7 +281,7 @@ public class UserControllerTest {
account1
.
setStatus
(
"Active"
);
account1
.
setStatus
(
"Active"
);
data
.
add
(
account1
);
data
.
add
(
account1
);
Account
account2
=
new
Account
();
Account
account2
=
new
Account
();
account2
.
setId
(
new
ObjectId
(
"2476ef15874c902c98b8a05d"
));
account2
.
setId
(
new
ObjectId
(
"2476ef15874c902c98b8a05d"
));
account2
.
setAccountId
(
"02"
);
account2
.
setAccountId
(
"02"
);
account2
.
setAccountName
(
"MACYS"
);
account2
.
setAccountName
(
"MACYS"
);
...
@@ -229,14 +295,14 @@ public class UserControllerTest {
...
@@ -229,14 +295,14 @@ public class UserControllerTest {
private
List
<
Skill
>
CreateSkill
()
{
private
List
<
Skill
>
CreateSkill
()
{
List
<
Skill
>
data
=
new
ArrayList
<>();
List
<
Skill
>
data
=
new
ArrayList
<>();
Skill
skills1
=
new
Skill
();
Skill
skills1
=
new
Skill
();
skills1
.
setId
(
new
ObjectId
(
"5976ef15874c902c98b8a05d"
));
skills1
.
setId
(
new
ObjectId
(
"5976ef15874c902c98b8a05d"
));
skills1
.
setSkillId
(
"01"
);
skills1
.
setSkillId
(
"01"
);
skills1
.
setSkillName
(
"Java"
);
skills1
.
setSkillName
(
"Java"
);
skills1
.
setActiveStatus
(
"Active"
);
skills1
.
setActiveStatus
(
"Active"
);
data
.
add
(
skills1
);
data
.
add
(
skills1
);
Skill
skills2
=
new
Skill
();
Skill
skills2
=
new
Skill
();
skills2
.
setId
(
new
ObjectId
(
"2476ef15874c902c98b8a05d"
));
skills2
.
setId
(
new
ObjectId
(
"2476ef15874c902c98b8a05d"
));
skills2
.
setSkillId
(
"02"
);
skills2
.
setSkillId
(
"02"
);
skills2
.
setSkillName
(
"Big Data"
);
skills2
.
setSkillName
(
"Big Data"
);
...
@@ -249,14 +315,14 @@ public class UserControllerTest {
...
@@ -249,14 +315,14 @@ public class UserControllerTest {
private
List
<
Designation
>
CreateDesignations
()
{
private
List
<
Designation
>
CreateDesignations
()
{
List
<
Designation
>
data
=
new
ArrayList
<>();
List
<
Designation
>
data
=
new
ArrayList
<>();
Designation
desig1
=
new
Designation
();
Designation
desig1
=
new
Designation
();
desig1
.
setId
(
new
ObjectId
(
"5976ef15874c902c98b8a05d"
));
desig1
.
setId
(
new
ObjectId
(
"5976ef15874c902c98b8a05d"
));
desig1
.
setDesignationId
(
"01"
);
desig1
.
setDesignationId
(
"01"
);
desig1
.
setDesignationName
(
"Manager"
);
desig1
.
setDesignationName
(
"Manager"
);
desig1
.
setActiveStatus
(
"Active"
);
desig1
.
setActiveStatus
(
"Active"
);
data
.
add
(
desig1
);
data
.
add
(
desig1
);
Designation
desig2
=
new
Designation
();
Designation
desig2
=
new
Designation
();
desig2
.
setId
(
new
ObjectId
(
"2476ef15874c902c98b8a05d"
));
desig2
.
setId
(
new
ObjectId
(
"2476ef15874c902c98b8a05d"
));
desig2
.
setDesignationId
(
"02"
);
desig2
.
setDesignationId
(
"02"
);
desig2
.
setDesignationName
(
"Employee"
);
desig2
.
setDesignationName
(
"Employee"
);
...
@@ -268,14 +334,14 @@ public class UserControllerTest {
...
@@ -268,14 +334,14 @@ public class UserControllerTest {
private
List
<
Shift
>
CreateShifts
()
{
private
List
<
Shift
>
CreateShifts
()
{
List
<
Shift
>
data
=
new
ArrayList
<>();
List
<
Shift
>
data
=
new
ArrayList
<>();
Shift
shift1
=
new
Shift
();
Shift
shift1
=
new
Shift
();
shift1
.
setId
(
new
ObjectId
(
"5976ef15874c902c98b8a05d"
));
shift1
.
setId
(
new
ObjectId
(
"5976ef15874c902c98b8a05d"
));
shift1
.
setShiftId
(
"01"
);
shift1
.
setShiftId
(
"01"
);
shift1
.
setShiftName
(
"Morning Shift"
);
shift1
.
setShiftName
(
"Morning Shift"
);
shift1
.
setActiveStatus
(
"Active"
);
shift1
.
setActiveStatus
(
"Active"
);
data
.
add
(
shift1
);
data
.
add
(
shift1
);
Shift
shift2
=
new
Shift
();
Shift
shift2
=
new
Shift
();
shift2
.
setId
(
new
ObjectId
(
"2476ef15874c902c98b8a05d"
));
shift2
.
setId
(
new
ObjectId
(
"2476ef15874c902c98b8a05d"
));
shift2
.
setShiftId
(
"02"
);
shift2
.
setShiftId
(
"02"
);
shift2
.
setShiftName
(
"Night Shift"
);
shift2
.
setShiftName
(
"Night Shift"
);
...
@@ -300,8 +366,8 @@ public class UserControllerTest {
...
@@ -300,8 +366,8 @@ public class UserControllerTest {
data1
.
setMobileNumber
(
"9978567809"
);
data1
.
setMobileNumber
(
"9978567809"
);
data1
.
setAlternateMobileNumber
(
"7789092345"
);
data1
.
setAlternateMobileNumber
(
"7789092345"
);
data1
.
setPersonalEmailId
(
"user1@gmail.com"
);
data1
.
setPersonalEmailId
(
"user1@gmail.com"
);
data1
.
setCreatedOn
(
new
Date
(
2017
-
11
-
21
));
data1
.
setCreatedOn
(
new
Date
(
2017
-
11
-
21
));
data1
.
setLastModifiedOn
(
new
Date
(
2017
-
12
-
22
));
data1
.
setLastModifiedOn
(
new
Date
(
2017
-
12
-
22
));
EmployeeRoles
data2
=
new
EmployeeRoles
();
EmployeeRoles
data2
=
new
EmployeeRoles
();
data2
.
setId
(
"4976ef15874c902c98b8a05d"
);
data2
.
setId
(
"4976ef15874c902c98b8a05d"
);
...
@@ -316,8 +382,8 @@ public class UserControllerTest {
...
@@ -316,8 +382,8 @@ public class UserControllerTest {
data2
.
setMobileNumber
(
"9989087671"
);
data2
.
setMobileNumber
(
"9989087671"
);
data2
.
setAlternateMobileNumber
(
"9999786756"
);
data2
.
setAlternateMobileNumber
(
"9999786756"
);
data2
.
setPersonalEmailId
(
"user2@gmail.com"
);
data2
.
setPersonalEmailId
(
"user2@gmail.com"
);
data2
.
setCreatedOn
(
new
Date
(
2017
-
11
-
23
));
data2
.
setCreatedOn
(
new
Date
(
2017
-
11
-
23
));
data2
.
setLastModifiedOn
(
new
Date
(
2017
-
12
-
22
));
data2
.
setLastModifiedOn
(
new
Date
(
2017
-
12
-
22
));
data
.
add
(
data1
);
data
.
add
(
data1
);
data
.
add
(
data2
);
data
.
add
(
data2
);
...
...
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