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
Hide 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
...
@@ -33,123 +33,148 @@ import com.nisum.mytime.service.UserService;
...
@@ -33,123 +33,148 @@ import com.nisum.mytime.service.UserService;
public
class
ProjectControllerTest
{
public
class
ProjectControllerTest
{
@Mock
@Mock
UserService
userService
;
UserService
userService
;
@Mock
@Mock
ProjectService
projectService
;
ProjectService
projectService
;
@Mock
@Mock
AccountRepo
accountRepo
;
AccountRepo
accountRepo
;
@InjectMocks
@InjectMocks
ProjectController
projectController
;
ProjectController
projectController
;
private
MockMvc
mockMvc
;
private
MockMvc
mockMvc
;
@Before
@Before
public
void
setup
()
{
public
void
setup
()
{
MockitoAnnotations
.
initMocks
(
this
);
MockitoAnnotations
.
initMocks
(
this
);
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
(
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
));
"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
(
"/project/employee"
).
param
(
"emailId"
,
"user@nisum.com"
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
null
,
null
,
new
Date
(
2017
-
11
-
12
),
new
Date
(
2017
-
12
-
12
));
verify
(
userService
).
getEmployeesRole
(
"user@nisum.com"
);
when
(
userService
.
getEmployeesRole
(
"user@nisum.com"
))
}
.
thenReturn
(
employeesRole
);
mockMvc
.
perform
(
get
(
"/project/employee"
).
param
(
"emailId"
,
"user@nisum.com"
))
@Test
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
public
void
testaddProject
()
throws
Exception
{
verify
(
userService
).
getEmployeesRole
(
"user@nisum.com"
);
List
<
String
>
list
=
new
ArrayList
<>();
}
list
.
add
(
"16101"
);
list
.
add
(
"16102"
);
@Test
list
.
add
(
"16103"
);
public
void
testaddProject
()
throws
Exception
{
Project
employeeRole1
=
new
Project
(
new
ObjectId
(
"9976ef15874c902c98b8a05d"
),
"102"
,
"OMS"
,
"16101"
,
"Srikanth"
,
"Macys"
,
"Billable"
,
list
);
List
<
String
>
list
=
new
ArrayList
<>();
String
jsonvalue
=(
new
ObjectMapper
()).
writeValueAsString
(
employeeRole1
).
toString
();
list
.
add
(
"16101"
);
Account
account
=
new
Account
(
new
ObjectId
(
"5a4f03661dca211ea7f94c02"
),
"2"
,
"Macys"
,
0
,
"Y"
);
list
.
add
(
"16102"
);
when
(
projectService
.
addProject
(
employeeRole1
)).
thenReturn
(
employeeRole1
);
list
.
add
(
"16103"
);
when
(
accountRepo
.
findByAccountName
(
"Macys"
)).
thenReturn
(
account
);
Project
employeeRole1
=
new
Project
(
mockMvc
.
perform
(
post
(
"/project/addProject"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
).
content
(
jsonvalue
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
new
ObjectId
(
"9976ef15874c902c98b8a05d"
),
"102"
,
"OMS"
,
"16101"
,
}
"Srikanth"
,
"Macys"
,
"Billable"
,
list
);
String
jsonvalue
=
(
new
ObjectMapper
())
@Test
.
writeValueAsString
(
employeeRole1
).
toString
();
public
void
testupdateEmployeeRole
()
throws
Exception
{
Account
account
=
new
Account
(
new
ObjectId
(
"5a4f03661dca211ea7f94c02"
),
List
<
String
>
list1
=
new
ArrayList
<>();
"2"
,
"Macys"
,
0
,
"Y"
);
list1
.
add
(
"16104"
);
when
(
projectService
.
addProject
(
employeeRole1
))
list1
.
add
(
"16105"
);
.
thenReturn
(
employeeRole1
);
list1
.
add
(
"16106"
);
when
(
accountRepo
.
findByAccountName
(
"Macys"
)).
thenReturn
(
account
);
Project
project
=
new
Project
(
new
ObjectId
(
"5976ef15874c902c98b8a05d"
),
"101"
,
"MOSAIC"
,
"16100"
,
"Rajeshekar"
,
"Gap"
,
"Billable"
,
list1
);
mockMvc
.
perform
(
post
(
"/project/addProject"
)
ObjectMapper
mapper
=
new
ObjectMapper
();
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)
String
jsonString
=
mapper
.
writeValueAsString
(
project
);
.
content
(
jsonvalue
))
when
(
projectService
.
updateProject
(
any
())).
thenReturn
(
project
);
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
mockMvc
.
perform
(
post
(
"/project/updateProject"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
).
content
(
jsonString
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
}
verify
(
projectService
).
updateProject
(
any
());
}
@Test
public
void
testupdateEmployeeRole
()
throws
Exception
{
@Test
List
<
String
>
list1
=
new
ArrayList
<>();
public
void
testdeleteProject
()
throws
Exception
{
list1
.
add
(
"16104"
);
mockMvc
.
perform
(
delete
(
"/project/deleteProject"
).
param
(
"projectId"
,
"101"
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
list1
.
add
(
"16105"
);
verify
(
projectService
).
deleteProject
(
"101"
);
list1
.
add
(
"16106"
);
}
Project
project
=
new
Project
(
new
ObjectId
(
"5976ef15874c902c98b8a05d"
),
"101"
,
"MOSAIC"
,
"16100"
,
"Rajeshekar"
,
"Gap"
,
"Billable"
,
@Test
list1
);
public
void
testgetProjects
()
throws
Exception
{
ObjectMapper
mapper
=
new
ObjectMapper
();
List
<
Project
>
projects
=
CreateProjectDetails
();
String
jsonString
=
mapper
.
writeValueAsString
(
project
);
when
(
projectService
.
getProjects
()).
thenReturn
(
projects
);
when
(
projectService
.
updateProject
(
any
())).
thenReturn
(
project
);
mockMvc
.
perform
(
get
(
"/project/getProjects"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
mockMvc
.
perform
(
post
(
"/project/updateProject"
)
verify
(
projectService
).
getProjects
();
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)
}
.
content
(
jsonString
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
projectService
).
updateProject
(
any
());
@Test
}
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
));
@Test
when
(
userService
.
getEmployeesRoleData
(
"16127"
)).
thenReturn
(
employeesRole
);
public
void
testdeleteProject
()
throws
Exception
{
mockMvc
.
perform
(
get
(
"/project/getEmployeeRoleData"
).
param
(
"empId"
,
"16127"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
mockMvc
.
perform
(
verify
(
userService
).
getEmployeesRoleData
(
"16127"
);
delete
(
"/project/deleteProject"
).
param
(
"projectId"
,
"101"
))
}
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
projectService
).
deleteProject
(
"101"
);
}
private
List
<
Project
>
CreateProjectDetails
()
{
List
<
Project
>
data
=
new
ArrayList
<>();
@Test
public
void
testgetProjects
()
throws
Exception
{
Project
data1
=
new
Project
();
List
<
Project
>
projects
=
CreateProjectDetails
();
data1
.
setId
(
new
ObjectId
(
"5976ef15874c902c98b8a05d"
));
when
(
projectService
.
getProjects
()).
thenReturn
(
projects
);
data1
.
setProjectId
(
"101"
);
mockMvc
.
perform
(
get
(
"/project/getProjects"
)
data1
.
setProjectName
(
"MOSAIC"
);
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
data1
.
setManagerId
(
"16110"
);
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
data1
.
setManagerName
(
"Rajeshekar"
);
verify
(
projectService
).
getProjects
();
data1
.
setStatus
(
"Billable"
);
}
data1
.
setAccount
(
"GAP"
);
List
<
String
>
list
=
new
ArrayList
<>();
@Test
list
.
add
(
"16101"
);
public
void
testgetEmployeeRoleData
()
throws
Exception
{
list
.
add
(
"16102"
);
EmployeeRoles
employeesRole
=
new
EmployeeRoles
(
list
.
add
(
"16103"
);
"5976ef15874c902c98b8a05d"
,
"16127"
,
null
,
null
,
null
,
null
,
data1
.
setEmployeeIds
(
list
);
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"
))
Project
data2
=
new
Project
();
.
thenReturn
(
employeesRole
);
data2
.
setId
(
new
ObjectId
(
"9976ef15874c902c98b8a05d"
));
mockMvc
.
perform
(
data2
.
setProjectId
(
"102"
);
get
(
"/project/getEmployeeRoleData"
).
param
(
"empId"
,
"16127"
)
data2
.
setProjectName
(
"OMS"
);
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
data2
.
setManagerId
(
"16111"
);
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
data2
.
setManagerName
(
"Reshma"
);
verify
(
userService
).
getEmployeesRoleData
(
"16127"
);
data2
.
setStatus
(
"Non-Billable"
);
}
data2
.
setAccount
(
"MACYS"
);
List
<
String
>
lists
=
new
ArrayList
<>();
private
List
<
Project
>
CreateProjectDetails
()
{
lists
.
add
(
"16104"
);
List
<
Project
>
data
=
new
ArrayList
<>();
lists
.
add
(
"16105"
);
lists
.
add
(
"16106"
);
Project
data1
=
new
Project
();
data2
.
setEmployeeIds
(
lists
);
data1
.
setId
(
new
ObjectId
(
"5976ef15874c902c98b8a05d"
));
data1
.
setProjectId
(
"101"
);
data
.
add
(
data1
);
data1
.
setProjectName
(
"MOSAIC"
);
data
.
add
(
data2
);
data1
.
setManagerId
(
"16110"
);
data1
.
setManagerName
(
"Rajeshekar"
);
return
data
;
data1
.
setStatus
(
"Billable"
);
}
data1
.
setAccount
(
"GAP"
);
List
<
String
>
list
=
new
ArrayList
<>();
list
.
add
(
"16101"
);
list
.
add
(
"16102"
);
list
.
add
(
"16103"
);
data1
.
setEmployeeIds
(
list
);
Project
data2
=
new
Project
();
data2
.
setId
(
new
ObjectId
(
"9976ef15874c902c98b8a05d"
));
data2
.
setProjectId
(
"102"
);
data2
.
setProjectName
(
"OMS"
);
data2
.
setManagerId
(
"16111"
);
data2
.
setManagerName
(
"Reshma"
);
data2
.
setStatus
(
"Non-Billable"
);
data2
.
setAccount
(
"MACYS"
);
List
<
String
>
lists
=
new
ArrayList
<>();
lists
.
add
(
"16104"
);
lists
.
add
(
"16105"
);
lists
.
add
(
"16106"
);
data2
.
setEmployeeIds
(
lists
);
data
.
add
(
data1
);
data
.
add
(
data2
);
return
data
;
}
}
}
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
;
...
@@ -30,346 +33,400 @@ import com.nisum.mytime.service.UserService;
...
@@ -30,346 +33,400 @@ import com.nisum.mytime.service.UserService;
public
class
ProjectTeamControllerTest
{
public
class
ProjectTeamControllerTest
{
@Mock
@Mock
UserService
userService
;
UserService
userService
;
@Mock
@Mock
ProjectService
projectService
;
ProjectService
projectService
;
@InjectMocks
@InjectMocks
ProjectTeamController
projectTeamController
;
ProjectTeamController
projectTeamController
;
private
MockMvc
mockMvc
;
private
MockMvc
mockMvc
;
@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
public
void
testgetEmployeeRole
()
throws
Exception
{
@Test
EmployeeRoles
employeesRole
=
new
EmployeeRoles
(
"5976ef15874c902c98b8a05d"
,
null
,
null
,
null
,
null
,
null
,
null
,
public
void
testgetEmployeeRole
()
throws
Exception
{
null
,
null
,
"user@nisum.com"
,
null
,
null
,
null
,
new
Date
(
2017
-
11
-
20
),
new
Date
(
2107
-
12
-
23
));
EmployeeRoles
employeesRole
=
new
EmployeeRoles
(
when
(
userService
.
getEmployeesRole
(
"user@nisum.com"
)).
thenReturn
(
employeesRole
);
"5976ef15874c902c98b8a05d"
,
null
,
null
,
null
,
null
,
null
,
null
,
mockMvc
.
perform
(
get
(
"/projectTeam/employee"
).
param
(
"emailId"
,
"user@nisum.com"
))
null
,
null
,
null
,
null
,
null
,
null
,
"user@nisum.com"
,
null
,
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
null
,
null
,
new
Date
(
2017
-
11
-
20
),
new
Date
(
2107
-
12
-
23
));
verify
(
userService
).
getEmployeesRole
(
"user@nisum.com"
);
when
(
userService
.
getEmployeesRole
(
"user@nisum.com"
))
}
.
thenReturn
(
employeesRole
);
mockMvc
.
perform
(
@Test
get
(
"/projectTeam/employee"
).
param
(
"emailId"
,
"user@nisum.com"
))
public
void
testaddProject
()
throws
Exception
{
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
List
<
String
>
list
=
new
ArrayList
<>();
verify
(
userService
).
getEmployeesRole
(
"user@nisum.com"
);
list
.
add
(
"16101"
);
}
list
.
add
(
"16102"
);
list
.
add
(
"16103"
);
@Test
Project
employeeRole1
=
new
Project
(
new
ObjectId
(
"9976ef15874c902c98b8a05d"
),
"102"
,
"OMS"
,
"16101"
,
"Srikanth"
,
public
void
testaddProject
()
throws
Exception
{
"Gap"
,
"Billable"
,
list
);
List
<
String
>
list
=
new
ArrayList
<>();
String
jsonvalue
=
(
new
ObjectMapper
()).
writeValueAsString
(
employeeRole1
).
toString
();
list
.
add
(
"16101"
);
when
(
projectService
.
addProject
(
employeeRole1
)).
thenReturn
(
employeeRole1
);
list
.
add
(
"16102"
);
mockMvc
.
perform
(
list
.
add
(
"16103"
);
post
(
"/projectTeam/addProject"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
).
content
(
jsonvalue
))
Project
employeeRole1
=
new
Project
(
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
new
ObjectId
(
"9976ef15874c902c98b8a05d"
),
"102"
,
"OMS"
,
"16101"
,
}
"Srikanth"
,
"Gap"
,
"Billable"
,
list
);
String
jsonvalue
=
(
new
ObjectMapper
())
@Test
.
writeValueAsString
(
employeeRole1
).
toString
();
public
void
testupdateEmployeeRole
()
throws
Exception
{
when
(
projectService
.
addProject
(
employeeRole1
))
EmployeeRoles
employeesRoles2
=
new
EmployeeRoles
(
"1976ef15874c902c98b8a05d"
,
"16111"
,
"Vinay Singh"
,
.
thenReturn
(
employeeRole1
);
"vsingh@nisum.com"
,
"Manager"
,
null
,
"09:00-06:00"
,
"Java/J2EE"
,
"Testing"
,
"8755672341"
,
"8800543678"
,
mockMvc
.
perform
(
post
(
"/projectTeam/addProject"
)
"vsingh@gmail.com"
,
null
,
new
Date
(
2017
-
11
-
29
),
new
Date
(
2017
-
12
-
20
));
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)
ObjectMapper
mapper
=
new
ObjectMapper
();
.
content
(
jsonvalue
))
String
jsonString
=
mapper
.
writeValueAsString
(
employeesRoles2
);
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
when
(
userService
.
updateEmployeeRole
(
any
())).
thenReturn
(
employeesRoles2
);
}
mockMvc
.
perform
(
post
(
"/projectTeam/updateEmployeeRole"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)
.
content
(
jsonString
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
@Test
verify
(
userService
).
updateEmployeeRole
(
any
());
public
void
testupdateEmployeeRole
()
throws
Exception
{
}
EmployeeRoles
employeesRoles2
=
new
EmployeeRoles
(
"1976ef15874c902c98b8a05d"
,
"16111"
,
"Vinay Singh"
,
@Test
"vsingh@nisum.com"
,
"Manager"
,
null
,
"09:00-06:00"
,
"Java/J2EE"
,
public
void
testdeleteEmployee
()
throws
Exception
{
"Testing"
,
"8755672341"
,
"8800543678"
,
"vsingh@gmail.com"
,
null
,
mockMvc
.
perform
(
delete
(
"/projectTeam/deleteEmployee"
).
param
(
"empId"
,
"16157"
))
null
,
null
,
null
,
null
,
new
Date
(
2017
-
11
-
29
),
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
new
Date
(
2017
-
12
-
20
));
verify
(
userService
).
deleteEmployee
(
"16157"
);
ObjectMapper
mapper
=
new
ObjectMapper
();
}
String
jsonString
=
mapper
.
writeValueAsString
(
employeesRoles2
);
when
(
userService
.
updateEmployeeRole
(
any
())).
thenReturn
(
employeesRoles2
);
@Test
mockMvc
.
perform
(
post
(
"/projectTeam/updateEmployeeRole"
)
public
void
testgetEmployeeRoleData
()
throws
Exception
{
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)
EmployeeRoles
employeesRole
=
new
EmployeeRoles
(
"5976ef15874c902c98b8a05d"
,
"16127"
,
null
,
null
,
null
,
null
,
.
content
(
jsonString
))
null
,
null
,
null
,
null
,
null
,
null
,
null
,
new
Date
(
2017
-
11
-
20
),
new
Date
(
2107
-
12
-
23
));
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
when
(
userService
.
getEmployeesRoleData
(
"16127"
)).
thenReturn
(
employeesRole
);
verify
(
userService
).
updateEmployeeRole
(
any
());
mockMvc
.
perform
(
get
(
"/projectTeam/getEmployeeRoleData"
).
param
(
"empId"
,
"16127"
)
}
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
getEmployeesRoleData
(
"16127"
);
@Test
}
public
void
testdeleteEmployee
()
throws
Exception
{
mockMvc
.
perform
(
@Test
delete
(
"/projectTeam/deleteEmployee"
).
param
(
"empId"
,
"16157"
))
public
void
testgetManagers
()
throws
Exception
{
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
List
<
EmployeeRoles
>
employeesRoles
=
createEmployeeRoles
();
verify
(
userService
).
deleteEmployee
(
"16157"
);
when
(
userService
.
getEmployeeRoles
()).
thenReturn
(
employeesRoles
);
}
mockMvc
.
perform
(
get
(
"/projectTeam/getEmployeesToTeam"
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
@Test
}
public
void
testgetEmployeeRoleData
()
throws
Exception
{
EmployeeRoles
employeesRole
=
new
EmployeeRoles
(
@Test
"5976ef15874c902c98b8a05d"
,
"16127"
,
null
,
null
,
null
,
null
,
public
void
testgetTeamDetails
()
throws
Exception
{
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
List
<
ProjectTeamMate
>
employeesRoles
=
createProjectTeamMate
();
null
,
new
Date
(
2017
-
11
-
20
),
new
Date
(
2107
-
12
-
23
));
when
(
projectService
.
getTeamDetails
(
"16127"
)).
thenReturn
(
employeesRoles
);
when
(
userService
.
getEmployeesRoleData
(
"16127"
))
mockMvc
.
perform
(
get
(
"/projectTeam/getTeamDetails"
).
param
(
"employeeId"
,
"16127"
))
.
thenReturn
(
employeesRole
);
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
mockMvc
.
perform
(
verify
(
projectService
).
getTeamDetails
(
"16127"
);
get
(
"/projectTeam/getEmployeeRoleData"
).
param
(
"empId"
,
"16127"
)
}
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
@Test
verify
(
userService
).
getEmployeesRoleData
(
"16127"
);
public
void
testaddEmployeeToTeam
()
throws
Exception
{
}
ProjectTeamMate
projectTeamMate
=
new
ProjectTeamMate
(
new
ObjectId
(
"1976ef15874c902c98b8a05d"
),
"16127"
,
"Monika Srivastava"
,
"msrivastava@nisum.com"
,
"Employee"
,
"09:00-06:00"
,
"101"
,
"MOSAIC"
,
"GAP"
,
@Test
"16081"
,
"Rajeshekar"
,
"01"
,
"Software Engineer"
,
"Non-Billable"
,
"8765588388"
,
new
Date
(),
new
Date
(),
true
);
public
void
testgetManagers
()
throws
Exception
{
String
jsonvalue
=
(
new
ObjectMapper
()).
writeValueAsString
(
projectTeamMate
).
toString
();
List
<
EmployeeRoles
>
employeesRoles
=
createEmployeeRoles
();
when
(
projectService
.
addProjectTeamMate
(
projectTeamMate
)).
thenReturn
(
projectTeamMate
);
when
(
userService
.
getEmployeeRoles
()).
thenReturn
(
employeesRoles
);
mockMvc
.
perform
(
mockMvc
.
perform
(
get
(
"/projectTeam/getEmployeesToTeam"
))
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
testgetTeamDetails
()
throws
Exception
{
ProjectTeamMate
updatedTeammate
=
new
ProjectTeamMate
(
new
ObjectId
(
"1976ef15874c902c98b8a05d"
),
"16127"
,
List
<
ProjectTeamMate
>
employeesRoles
=
createProjectTeamMate
();
"Monika Srivastava"
,
"msrivastava@nisum.com"
,
"Employee"
,
"09:00-06:00"
,
"101"
,
"MOSAIC"
,
"GAP"
,
when
(
projectService
.
getTeamDetails
(
"16127"
)).
thenReturn
(
employeesRoles
);
"16081"
,
"Rajeshekar"
,
"01"
,
"Software Engineer"
,
"Non-Billable"
,
"8765588388"
,
new
Date
(),
new
Date
(),
true
);
mockMvc
.
perform
(
String
jsonvalue
=
(
new
ObjectMapper
()).
writeValueAsString
(
updatedTeammate
).
toString
();
get
(
"/projectTeam/getTeamDetails"
).
param
(
"employeeId"
,
"16127"
))
when
(
projectService
.
updateTeammate
(
updatedTeammate
)).
thenReturn
(
updatedTeammate
);
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
mockMvc
.
perform
(
verify
(
projectService
).
getTeamDetails
(
"16127"
);
post
(
"/projectTeam/updateTeammate"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
).
content
(
jsonvalue
))
}
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
}
@Test
public
void
testaddEmployeeToTeam
()
throws
Exception
{
@Test
ProjectTeamMate
projectTeamMate
=
new
ProjectTeamMate
(
public
void
testdeleteTeammate
()
throws
Exception
{
new
ObjectId
(
"1976ef15874c902c98b8a05d"
),
"16127"
,
ProjectTeamMate
deleteTeamMate
=
new
ProjectTeamMate
(
new
ObjectId
(
"1976ef15874c902c98b8a05d"
),
"16127"
,
"Monika Srivastava"
,
"msrivastava@nisum.com"
,
"Employee"
,
"Monika Srivastava"
,
"msrivastava@nisum.com"
,
"Employee"
,
"09:00-06:00"
,
"101"
,
"MOSAIC"
,
"GAP"
,
"09:00-06:00"
,
"101"
,
"MOSAIC"
,
"GAP"
,
"16081"
,
"Rajeshekar"
,
"16081"
,
"Rajeshekar"
,
"01"
,
"Software Engineer"
,
"Non-Billable"
,
"8765588388"
,
new
Date
(),
new
Date
(),
true
);
"01"
,
"Software Engineer"
,
"Non-Billable"
,
"8765588388"
,
String
jsonvalue
=
(
new
ObjectMapper
()).
writeValueAsString
(
deleteTeamMate
).
toString
();
new
Date
(),
new
Date
(),
true
);
mockMvc
.
perform
(
String
jsonvalue
=
(
new
ObjectMapper
())
post
(
"/projectTeam/deleteTeammate"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
).
content
(
jsonvalue
))
.
writeValueAsString
(
projectTeamMate
).
toString
();
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
when
(
projectService
.
addProjectTeamMate
(
projectTeamMate
))
verify
(
projectService
).
deleteTeammate
(
"16127"
,
"101"
,
new
ObjectId
(
"1976ef15874c902c98b8a05d"
));
.
thenReturn
(
projectTeamMate
);
}
mockMvc
.
perform
(
post
(
"/projectTeam/addEmployeeToTeam"
)
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)
@Test
.
content
(
jsonvalue
))
public
void
testgetProjects
()
throws
Exception
{
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
List
<
Project
>
projects
=
CreateProjectDetails
();
}
when
(
projectService
.
getProjects
(
"16127"
)).
thenReturn
(
projects
);
mockMvc
.
perform
(
get
(
"/projectTeam/getProjects"
).
param
(
"employeeId"
,
"16127"
))
@Test
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
public
void
testupdateTeammate
()
throws
Exception
{
verify
(
projectService
).
getProjects
(
"16127"
);
ProjectTeamMate
updatedTeammate
=
new
ProjectTeamMate
(
}
new
ObjectId
(
"1976ef15874c902c98b8a05d"
),
"16127"
,
"Monika Srivastava"
,
"msrivastava@nisum.com"
,
"Employee"
,
@Test
"09:00-06:00"
,
"101"
,
"MOSAIC"
,
"GAP"
,
"16081"
,
"Rajeshekar"
,
public
void
testgetMyTeamDetails
()
throws
Exception
{
"01"
,
"Software Engineer"
,
"Non-Billable"
,
"8765588388"
,
List
<
ProjectTeamMate
>
employeesRoles
=
createProjectTeamMate
();
new
Date
(),
new
Date
(),
true
);
when
(
projectService
.
getMyTeamDetails
(
"16127"
)).
thenReturn
(
employeesRoles
);
String
jsonvalue
=
(
new
ObjectMapper
())
mockMvc
.
perform
(
get
(
"/projectTeam/getMyTeamDetails"
).
param
(
"employeeId"
,
"16127"
))
.
writeValueAsString
(
updatedTeammate
).
toString
();
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
when
(
projectService
.
updateTeammate
(
updatedTeammate
))
verify
(
projectService
).
getMyTeamDetails
(
"16127"
);
.
thenReturn
(
updatedTeammate
);
}
mockMvc
.
perform
(
post
(
"/projectTeam/updateTeammate"
)
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)
@Test
.
content
(
jsonvalue
))
public
void
testgetUnAssignedEmployees
()
throws
Exception
{
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
List
<
EmployeeRoles
>
employeesRoles
=
createEmployeeRoles
();
}
when
(
projectService
.
getUnAssignedEmployees
()).
thenReturn
(
employeesRoles
);
mockMvc
.
perform
(
get
(
"/projectTeam/getUnAssignedEmployees"
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
@Test
verify
(
projectService
).
getUnAssignedEmployees
();
public
void
testdeleteTeammate
()
throws
Exception
{
}
ProjectTeamMate
deleteTeamMate
=
new
ProjectTeamMate
(
new
ObjectId
(
"1976ef15874c902c98b8a05d"
),
"16127"
,
@Test
"Monika Srivastava"
,
"msrivastava@nisum.com"
,
"Employee"
,
public
void
testgetShiftDetails
()
throws
Exception
{
"09:00-06:00"
,
"101"
,
"MOSAIC"
,
"GAP"
,
"16081"
,
"Rajeshekar"
,
List
<
ProjectTeamMate
>
employeesRoles
=
createProjectTeamMate
();
"01"
,
"Software Engineer"
,
"Non-Billable"
,
"8765588388"
,
when
(
projectService
.
getShiftDetails
(
"09:00-06:00"
)).
thenReturn
(
employeesRoles
);
new
Date
(),
new
Date
(),
true
);
mockMvc
.
perform
(
get
(
"/projectTeam/getShiftDetails"
).
param
(
"shift"
,
"09:00-06:00"
))
String
jsonvalue
=
(
new
ObjectMapper
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
.
writeValueAsString
(
deleteTeamMate
).
toString
();
verify
(
projectService
).
getShiftDetails
(
"09:00-06:00"
);
mockMvc
.
perform
(
post
(
"/projectTeam/deleteTeammate"
)
}
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)
.
content
(
jsonvalue
))
@Test
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
public
void
testgetProjectAllocations
()
throws
Exception
{
verify
(
projectService
).
deleteTeammate
(
"16127"
,
"101"
,
List
<
ProjectTeamMate
>
employeesRoles
=
createProjectTeamMate
();
new
ObjectId
(
"1976ef15874c902c98b8a05d"
));
when
(
projectService
.
getAllProjectDetails
()).
thenReturn
(
employeesRoles
);
}
mockMvc
.
perform
(
get
(
"/projectTeam/getProjectAllocations"
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
projectService
).
getAllProjectDetails
();
@Test
}
public
void
testgetProjects
()
throws
Exception
{
List
<
Project
>
projects
=
CreateProjectDetails
();
@Test
when
(
projectService
.
getProjects
(
"16127"
)).
thenReturn
(
projects
);
public
void
testgetProjectDetails
()
throws
Exception
{
mockMvc
.
perform
(
List
<
ProjectTeamMate
>
employeesRoles
=
createProjectTeamMate
();
get
(
"/projectTeam/getProjects"
).
param
(
"employeeId"
,
"16127"
))
when
(
projectService
.
getProjectDetails
(
"101"
)).
thenReturn
(
employeesRoles
);
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
mockMvc
.
perform
(
get
(
"/projectTeam/getProjectDetails"
).
param
(
"projectId"
,
"101"
))
verify
(
projectService
).
getProjects
(
"16127"
);
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
}
verify
(
projectService
).
getProjectDetails
(
"101"
);
}
@Test
public
void
testgetMyTeamDetails
()
throws
Exception
{
@Test
List
<
ProjectTeamMate
>
employeesRoles
=
createProjectTeamMate
();
public
void
testgetMyProjectAllocations
()
throws
Exception
{
when
(
projectService
.
getMyTeamDetails
(
"16127"
))
List
<
ProjectTeamMate
>
projectAllocations
=
createProjectTeamMate
();
.
thenReturn
(
employeesRoles
);
System
.
out
.
println
(
projectAllocations
);
mockMvc
.
perform
(
get
(
"/projectTeam/getMyTeamDetails"
).
param
(
"employeeId"
,
when
(
projectService
.
getMyProjectAllocations
(
"16127"
)).
thenReturn
(
projectAllocations
);
"16127"
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
mockMvc
.
perform
(
get
(
"/projectTeam/getMyProjectAllocations"
).
param
(
"employeeId"
,
"16127"
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
projectService
).
getMyTeamDetails
(
"16127"
);
verify
(
projectService
).
getMyProjectAllocations
(
"16127"
);
}
}
@Test
@Test
public
void
testgetUnAssignedEmployees
()
throws
Exception
{
public
void
testgetEmployeeBillingDetails
()
throws
Exception
{
List
<
EmployeeRoles
>
employeesRoles
=
createEmployeeRoles
();
List
<
TeamMateBilling
>
billings
=
CreateTeamMateBilling
();
when
(
projectService
.
getUnAssignedEmployees
())
System
.
out
.
println
(
billings
);
.
thenReturn
(
employeesRoles
);
when
(
projectService
.
getEmployeeBillingDetails
(
"16127"
,
"101"
)).
thenReturn
(
billings
);
mockMvc
.
perform
(
get
(
"/projectTeam/getUnAssignedEmployees"
))
mockMvc
.
perform
(
get
(
"/projectTeam/getEmployeeBillingDetails"
).
param
(
"employeeId"
,
"16127"
).
param
(
"projectId"
,
"101"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
projectService
).
getUnAssignedEmployees
();
verify
(
projectService
).
getEmployeeBillingDetails
(
"16127"
,
"101"
);
}
}
@Test
private
List
<
TeamMateBilling
>
CreateTeamMateBilling
()
{
public
void
testgetShiftDetails
()
throws
Exception
{
List
<
TeamMateBilling
>
data
=
new
ArrayList
<>();
List
<
ProjectTeamMate
>
employeesRoles
=
createProjectTeamMate
();
when
(
projectService
.
getShiftDetails
(
"09:00-06:00"
))
TeamMateBilling
team1
=
new
TeamMateBilling
();
.
thenReturn
(
employeesRoles
);
team1
.
setId
(
new
ObjectId
(
"5976ef15874c902c98b8a05d"
));
mockMvc
.
perform
(
get
(
"/projectTeam/getShiftDetails"
).
param
(
"shift"
,
team1
.
setEmployeeId
(
"16127"
);
"09:00-06:00"
))
team1
.
setEmployeeName
(
"Employee1"
);
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
team1
.
setProjectId
(
"101"
);
verify
(
projectService
).
getShiftDetails
(
"09:00-06:00"
);
team1
.
setProjectName
(
"MOSAIC"
);
}
team1
.
setBillingStartDate
(
new
Date
(
2017
-
01
-
10
));
team1
.
setBillingEndDate
(
new
Date
(
2017
-
02
-
10
));
@Test
team1
.
setActive
(
true
);
public
void
testgetProjectAllocations
()
throws
Exception
{
data
.
add
(
team1
);
List
<
ProjectTeamMate
>
employeesRoles
=
createProjectTeamMate
();
when
(
projectService
.
getAllProjectDetails
()).
thenReturn
(
employeesRoles
);
TeamMateBilling
team2
=
new
TeamMateBilling
();
mockMvc
.
perform
(
get
(
"/projectTeam/getProjectAllocations"
))
team2
.
setId
(
new
ObjectId
(
"1976ef15874c902c98b8a05d"
));
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
team2
.
setEmployeeId
(
"16128"
);
verify
(
projectService
).
getAllProjectDetails
();
team2
.
setEmployeeName
(
"Employee2"
);
}
team2
.
setProjectId
(
"102"
);
team2
.
setProjectName
(
"OMS"
);
@Test
team2
.
setBillingStartDate
(
new
Date
(
2017
-
01
-
15
));
public
void
testgetProjectDetails
()
throws
Exception
{
team2
.
setBillingEndDate
(
new
Date
(
2017
-
02
-
15
));
List
<
ProjectTeamMate
>
employeesRoles
=
createProjectTeamMate
();
team2
.
setActive
(
false
);
when
(
projectService
.
getProjectDetails
(
"101"
))
data
.
add
(
team2
);
.
thenReturn
(
employeesRoles
);
mockMvc
.
perform
(
return
data
;
get
(
"/projectTeam/getProjectDetails"
).
param
(
"projectId"
,
"101"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
}
verify
(
projectService
).
getProjectDetails
(
"101"
);
}
private
List
<
Project
>
CreateProjectDetails
()
{
List
<
Project
>
data
=
new
ArrayList
<>();
@Test
public
void
testgetMyProjectAllocations
()
throws
Exception
{
Project
data1
=
new
Project
();
List
<
ProjectTeamMate
>
projectAllocations
=
createProjectTeamMate
();
data1
.
setId
(
new
ObjectId
(
"5976ef15874c902c98b8a05d"
));
System
.
out
.
println
(
projectAllocations
);
data1
.
setProjectId
(
"101"
);
when
(
projectService
.
getMyProjectAllocations
(
"16127"
))
data1
.
setProjectName
(
"MOSAIC"
);
.
thenReturn
(
projectAllocations
);
data1
.
setManagerId
(
"16110"
);
mockMvc
.
perform
(
get
(
"/projectTeam/getMyProjectAllocations"
)
data1
.
setManagerName
(
"Rajeshekar"
);
.
param
(
"employeeId"
,
"16127"
))
data1
.
setStatus
(
"Billable"
);
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
data1
.
setAccount
(
"Gap"
);
verify
(
projectService
).
getMyProjectAllocations
(
"16127"
);
List
<
String
>
list
=
new
ArrayList
<>();
}
list
.
add
(
"16101"
);
list
.
add
(
"16102"
);
@Test
list
.
add
(
"16103"
);
public
void
testgetEmployeeBillingDetails
()
throws
Exception
{
data1
.
setEmployeeIds
(
list
);
List
<
TeamMateBilling
>
billings
=
CreateTeamMateBilling
();
System
.
out
.
println
(
billings
);
Project
data2
=
new
Project
();
when
(
projectService
.
getEmployeeBillingDetails
(
"16127"
,
"101"
))
data2
.
setId
(
new
ObjectId
(
"9976ef15874c902c98b8a05d"
));
.
thenReturn
(
billings
);
data2
.
setProjectId
(
"102"
);
mockMvc
.
perform
(
get
(
"/projectTeam/getEmployeeBillingDetails"
)
data2
.
setProjectName
(
"OMS"
);
.
param
(
"employeeId"
,
"16127"
).
param
(
"projectId"
,
"101"
))
data2
.
setManagerId
(
"16111"
);
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
data2
.
setManagerName
(
"Reshma"
);
verify
(
projectService
).
getEmployeeBillingDetails
(
"16127"
,
"101"
);
data2
.
setStatus
(
"Billable"
);
}
data2
.
setAccount
(
"Macys"
);
List
<
String
>
lists
=
new
ArrayList
<>();
private
List
<
TeamMateBilling
>
CreateTeamMateBilling
()
{
lists
.
add
(
"16104"
);
List
<
TeamMateBilling
>
data
=
new
ArrayList
<>();
lists
.
add
(
"16105"
);
lists
.
add
(
"16106"
);
TeamMateBilling
team1
=
new
TeamMateBilling
();
data2
.
setEmployeeIds
(
lists
);
team1
.
setId
(
new
ObjectId
(
"5976ef15874c902c98b8a05d"
));
team1
.
setEmployeeId
(
"16127"
);
data
.
add
(
data1
);
team1
.
setEmployeeName
(
"Employee1"
);
data
.
add
(
data2
);
team1
.
setProjectId
(
"101"
);
team1
.
setProjectName
(
"MOSAIC"
);
return
data
;
team1
.
setBillingStartDate
(
new
Date
(
2017
-
01
-
10
));
}
team1
.
setBillingEndDate
(
new
Date
(
2017
-
02
-
10
));
team1
.
setActive
(
true
);
private
List
<
ProjectTeamMate
>
createProjectTeamMate
()
{
data
.
add
(
team1
);
List
<
ProjectTeamMate
>
data
=
new
ArrayList
<>();
TeamMateBilling
team2
=
new
TeamMateBilling
();
ProjectTeamMate
record1
=
new
ProjectTeamMate
();
team2
.
setId
(
new
ObjectId
(
"1976ef15874c902c98b8a05d"
));
record1
.
setId
(
new
ObjectId
(
"3976ef15874c902c98b8a05d"
));
team2
.
setEmployeeId
(
"16128"
);
record1
.
setEmployeeId
(
"16127"
);
team2
.
setEmployeeName
(
"Employee2"
);
record1
.
setEmployeeName
(
"Monika Srivastava"
);
team2
.
setProjectId
(
"102"
);
record1
.
setEmailId
(
"msrivastava@nisum.com"
);
team2
.
setProjectName
(
"OMS"
);
record1
.
setRole
(
"Employee"
);
team2
.
setBillingStartDate
(
new
Date
(
2017
-
01
-
15
));
record1
.
setShift
(
"09:00-06:00"
);
team2
.
setBillingEndDate
(
new
Date
(
2017
-
02
-
15
));
record1
.
setProjectId
(
"101"
);
team2
.
setActive
(
false
);
record1
.
setProjectName
(
"Mosaic"
);
data
.
add
(
team2
);
record1
.
setAccount
(
"Gap"
);
record1
.
setManagerId
(
"16081"
);
return
data
;
record1
.
setManagerName
(
"Rajeshekar"
);
record1
.
setExperience
(
"01 Year"
);
}
record1
.
setDesignation
(
"Software Engineer"
);
record1
.
setBillableStatus
(
"Non-Billable"
);
private
List
<
Project
>
CreateProjectDetails
()
{
record1
.
setMobileNumber
(
"8765588388"
);
List
<
Project
>
data
=
new
ArrayList
<>();
ProjectTeamMate
record2
=
new
ProjectTeamMate
();
Project
data1
=
new
Project
();
record2
.
setId
(
new
ObjectId
(
"2976ef15874c902c98b8a05d"
));
data1
.
setId
(
new
ObjectId
(
"5976ef15874c902c98b8a05d"
));
record2
.
setEmployeeId
(
"16111"
);
data1
.
setProjectId
(
"101"
);
record2
.
setEmployeeName
(
"Vinay Singh"
);
data1
.
setProjectName
(
"MOSAIC"
);
record2
.
setEmailId
(
"vsingh@nisum.com"
);
data1
.
setManagerId
(
"16110"
);
record2
.
setRole
(
"Employee"
);
data1
.
setManagerName
(
"Rajeshekar"
);
record2
.
setShift
(
"09:00-06:00"
);
data1
.
setStatus
(
"Billable"
);
record2
.
setProjectId
(
"101"
);
data1
.
setAccount
(
"Gap"
);
record2
.
setProjectName
(
"Mosaic"
);
List
<
String
>
list
=
new
ArrayList
<>();
record2
.
setAccount
(
"Gap"
);
list
.
add
(
"16101"
);
record2
.
setManagerId
(
"16081"
);
list
.
add
(
"16102"
);
record2
.
setManagerName
(
"Rajeshekar"
);
list
.
add
(
"16103"
);
record2
.
setExperience
(
"07 Year"
);
data1
.
setEmployeeIds
(
list
);
record2
.
setDesignation
(
"Senoir Software Engineer"
);
record2
.
setBillableStatus
(
"Billable"
);
Project
data2
=
new
Project
();
record2
.
setMobileNumber
(
"8765588399"
);
data2
.
setId
(
new
ObjectId
(
"9976ef15874c902c98b8a05d"
));
data2
.
setProjectId
(
"102"
);
data
.
add
(
record1
);
data2
.
setProjectName
(
"OMS"
);
data
.
add
(
record2
);
data2
.
setManagerId
(
"16111"
);
data2
.
setManagerName
(
"Reshma"
);
return
data
;
data2
.
setStatus
(
"Billable"
);
}
data2
.
setAccount
(
"Macys"
);
List
<
String
>
lists
=
new
ArrayList
<>();
private
List
<
EmployeeRoles
>
createEmployeeRoles
()
{
lists
.
add
(
"16104"
);
List
<
EmployeeRoles
>
data
=
new
ArrayList
<>();
lists
.
add
(
"16105"
);
lists
.
add
(
"16106"
);
EmployeeRoles
record1
=
new
EmployeeRoles
();
data2
.
setEmployeeIds
(
lists
);
record1
.
setId
(
"5976ef15874c902c98b8a05d"
);
record1
.
setEmployeeId
(
"16127"
);
data
.
add
(
data1
);
record1
.
setEmployeeName
(
"Monika Srivastava"
);
data
.
add
(
data2
);
record1
.
setEmailId
(
"msrivastava@nisum.com"
);
record1
.
setRole
(
"Employee"
);
return
data
;
record1
.
setShift
(
"09:00-06:00"
);
}
record1
.
setBaseTechnology
(
"Spring"
);
record1
.
setTechnologyKnown
(
"Java"
);
private
List
<
ProjectTeamMate
>
createProjectTeamMate
()
{
record1
.
setMobileNumber
(
"9900786755"
);
List
<
ProjectTeamMate
>
data
=
new
ArrayList
<>();
record1
.
setAlternateMobileNumber
(
"7689009876"
);
record1
.
setPersonalEmailId
(
"msrivastava@gmail.com"
);
ProjectTeamMate
record1
=
new
ProjectTeamMate
();
record1
.
setCreatedOn
(
new
Date
(
2017
-
11
-
18
));
record1
.
setId
(
new
ObjectId
(
"3976ef15874c902c98b8a05d"
));
record1
.
setLastModifiedOn
(
new
Date
(
2017
-
12
-
13
));
record1
.
setEmployeeId
(
"16127"
);
record1
.
setEmployeeName
(
"Monika Srivastava"
);
EmployeeRoles
record2
=
new
EmployeeRoles
();
record1
.
setEmailId
(
"msrivastava@nisum.com"
);
record2
.
setId
(
"8976ef15874c902c98b8a05d"
);
record1
.
setRole
(
"Employee"
);
record2
.
setEmployeeId
(
"16081"
);
record1
.
setShift
(
"09:00-06:00"
);
record2
.
setEmployeeName
(
"Rajeshekar"
);
record1
.
setProjectId
(
"101"
);
record2
.
setEmailId
(
"manager@nisum.com"
);
record1
.
setProjectName
(
"Mosaic"
);
record2
.
setRole
(
"Manager"
);
record1
.
setAccount
(
"Gap"
);
record2
.
setShift
(
"03:00-12:00"
);
record1
.
setManagerId
(
"16081"
);
record2
.
setBaseTechnology
(
"Hibernate"
);
record1
.
setManagerName
(
"Rajeshekar"
);
record2
.
setTechnologyKnown
(
"EJB"
);
record1
.
setExperience
(
"01 Year"
);
record2
.
setMobileNumber
(
"9109897867"
);
record1
.
setDesignation
(
"Software Engineer"
);
record2
.
setAlternateMobileNumber
(
"9129098767"
);
record1
.
setBillableStatus
(
"Non-Billable"
);
record2
.
setPersonalEmailId
(
"manager@gmail.com"
);
record1
.
setMobileNumber
(
"8765588388"
);
record2
.
setCreatedOn
(
new
Date
(
2017
-
11
-
18
));
record2
.
setLastModifiedOn
(
new
Date
(
2017
-
12
-
21
));
ProjectTeamMate
record2
=
new
ProjectTeamMate
();
record2
.
setId
(
new
ObjectId
(
"2976ef15874c902c98b8a05d"
));
data
.
add
(
record1
);
record2
.
setEmployeeId
(
"16111"
);
data
.
add
(
record2
);
record2
.
setEmployeeName
(
"Vinay Singh"
);
return
data
;
record2
.
setEmailId
(
"vsingh@nisum.com"
);
}
record2
.
setRole
(
"Employee"
);
record2
.
setShift
(
"09:00-06:00"
);
record2
.
setProjectId
(
"101"
);
record2
.
setProjectName
(
"Mosaic"
);
record2
.
setAccount
(
"Gap"
);
record2
.
setManagerId
(
"16081"
);
record2
.
setManagerName
(
"Rajeshekar"
);
record2
.
setExperience
(
"07 Year"
);
record2
.
setDesignation
(
"Senoir Software Engineer"
);
record2
.
setBillableStatus
(
"Billable"
);
record2
.
setMobileNumber
(
"8765588399"
);
data
.
add
(
record1
);
data
.
add
(
record2
);
return
data
;
}
private
List
<
EmployeeRoles
>
createEmployeeRoles
()
{
List
<
EmployeeRoles
>
data
=
new
ArrayList
<>();
EmployeeRoles
record1
=
new
EmployeeRoles
();
record1
.
setId
(
"5976ef15874c902c98b8a05d"
);
record1
.
setEmployeeId
(
"16127"
);
record1
.
setEmployeeName
(
"Monika Srivastava"
);
record1
.
setEmailId
(
"msrivastava@nisum.com"
);
record1
.
setRole
(
"Employee"
);
record1
.
setShift
(
"09:00-06:00"
);
record1
.
setBaseTechnology
(
"Spring"
);
record1
.
setTechnologyKnown
(
"Java"
);
record1
.
setMobileNumber
(
"9900786755"
);
record1
.
setAlternateMobileNumber
(
"7689009876"
);
record1
.
setPersonalEmailId
(
"msrivastava@gmail.com"
);
record1
.
setCreatedOn
(
new
Date
(
2017
-
11
-
18
));
record1
.
setLastModifiedOn
(
new
Date
(
2017
-
12
-
13
));
EmployeeRoles
record2
=
new
EmployeeRoles
();
record2
.
setId
(
"8976ef15874c902c98b8a05d"
);
record2
.
setEmployeeId
(
"16081"
);
record2
.
setEmployeeName
(
"Rajeshekar"
);
record2
.
setEmailId
(
"manager@nisum.com"
);
record2
.
setRole
(
"Manager"
);
record2
.
setShift
(
"03:00-12:00"
);
record2
.
setBaseTechnology
(
"Hibernate"
);
record2
.
setTechnologyKnown
(
"EJB"
);
record2
.
setMobileNumber
(
"9109897867"
);
record2
.
setAlternateMobileNumber
(
"9129098767"
);
record2
.
setPersonalEmailId
(
"manager@gmail.com"
);
record2
.
setCreatedOn
(
new
Date
(
2017
-
11
-
18
));
record2
.
setLastModifiedOn
(
new
Date
(
2017
-
12
-
21
));
data
.
add
(
record1
);
data
.
add
(
record2
);
return
data
;
}
}
}
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
;
...
@@ -33,295 +36,358 @@ import com.nisum.mytime.service.UserService;
...
@@ -33,295 +36,358 @@ import com.nisum.mytime.service.UserService;
public
class
UserControllerTest
{
public
class
UserControllerTest
{
@Mock
@Mock
UserService
userService
;
UserService
userService
;
@InjectMocks
@InjectMocks
UserController
userController
;
UserController
userController
;
private
MockMvc
mockMvc
;
private
MockMvc
mockMvc
;
@Before
@Before
public
void
setup
()
{
public
void
setup
()
{
MockitoAnnotations
.
initMocks
(
this
);
MockitoAnnotations
.
initMocks
(
this
);
mockMvc
=
MockMvcBuilders
.
standaloneSetup
(
userController
).
build
();
mockMvc
=
MockMvcBuilders
.
standaloneSetup
(
userController
).
build
();
}
}
@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
));
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
when
(
userService
.
getEmployeesRole
(
"user@nisum.com"
))
verify
(
userService
).
getEmployeesRole
(
"user@nisum.com"
);
.
thenReturn
(
employeesRole
);
}
mockMvc
.
perform
(
get
(
"/user/employee"
).
param
(
"emailId"
,
"user@nisum.com"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
@Test
verify
(
userService
).
getEmployeesRole
(
"user@nisum.com"
);
public
void
testassigingEmployeeRole
()
throws
Exception
{
}
EmployeeRoles
employeeRole
=
new
EmployeeRoles
(
"5976ef15874c902c98b8a05c"
,
"16135"
,
"Monika"
,
"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
));
@Test
ObjectMapper
mapper
=
new
ObjectMapper
();
public
void
testassigingEmployeeRole
()
throws
Exception
{
String
jsonString
=
mapper
.
writeValueAsString
(
employeeRole
);
EmployeeRoles
employeeRole
=
new
EmployeeRoles
(
when
(
userService
.
assigingEmployeeRole
(
anyObject
())).
thenReturn
(
employeeRole
);
"5976ef15874c902c98b8a05c"
,
"16135"
,
"Monika"
,
mockMvc
.
perform
(
"user1@nisum.com"
,
"HR"
,
"Human Resource Lead"
,
"06:00-09:00"
,
post
(
"/user/assignEmployeeRole"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
).
content
(
jsonString
))
"Java/J2EE"
,
"Spring"
,
"8767893452"
,
"5687234567"
,
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
"user1@gmail.com"
,
null
,
null
,
null
,
null
,
null
,
verify
(
userService
).
assigingEmployeeRole
(
anyObject
());
new
Date
(
2017
-
11
-
20
),
new
Date
(
2017
-
12
-
23
));
}
ObjectMapper
mapper
=
new
ObjectMapper
();
String
jsonString
=
mapper
.
writeValueAsString
(
employeeRole
);
@Test
when
(
userService
.
assigingEmployeeRole
(
anyObject
()))
public
void
testupdateEmployeeRole
()
throws
Exception
{
.
thenReturn
(
employeeRole
);
EmployeeRoles
employeeRole2
=
new
EmployeeRoles
(
"5976ef15874c902c98b8a05d"
,
"67890"
,
"Sonika"
,
mockMvc
.
perform
(
post
(
"/user/assignEmployeeRole"
)
"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
));
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)
ObjectMapper
mapper
=
new
ObjectMapper
();
.
content
(
jsonString
))
String
jsonString
=
mapper
.
writeValueAsString
(
employeeRole2
);
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
when
(
userService
.
updateEmployeeRole
(
anyObject
())).
thenReturn
(
employeeRole2
);
verify
(
userService
).
assigingEmployeeRole
(
anyObject
());
mockMvc
.
perform
(
}
post
(
"/user/updateEmployeeRole"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
).
content
(
jsonString
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
@Test
verify
(
userService
).
updateEmployeeRole
(
anyObject
());
public
void
testupdateEmployeeRole
()
throws
Exception
{
}
EmployeeRoles
employeeRole2
=
new
EmployeeRoles
(
"5976ef15874c902c98b8a05d"
,
"67890"
,
"Sonika"
,
@Test
"user2@nisum.com"
,
"Manager"
,
"Senior Software Engineer"
,
public
void
testdeleteEmployee
()
throws
Exception
{
"09:00am-06:00am"
,
"php"
,
"Hibernate"
,
"9878678956"
,
mockMvc
.
perform
(
delete
(
"/user/deleteEmployee"
).
param
(
"empId"
,
"16127"
))
"9989782210"
,
"user2@gmail.com"
,
null
,
null
,
null
,
null
,
null
,
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
new
Date
(
2017
-
11
-
20
),
new
Date
(
2017
-
12
-
23
));
verify
(
userService
).
deleteEmployee
(
"16127"
);
ObjectMapper
mapper
=
new
ObjectMapper
();
}
String
jsonString
=
mapper
.
writeValueAsString
(
employeeRole2
);
when
(
userService
.
updateEmployeeRole
(
anyObject
()))
@Test
.
thenReturn
(
employeeRole2
);
public
void
testgetUserRoles
()
throws
Exception
{
mockMvc
.
perform
(
post
(
"/user/updateEmployeeRole"
)
List
<
EmployeeRoles
>
employeesRole3
=
CreateUserRoles
();
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)
when
(
userService
.
getEmployeeRoles
()).
thenReturn
(
employeesRole3
);
.
content
(
jsonString
))
mockMvc
.
perform
(
get
(
"/user/getUserRoles"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
updateEmployeeRole
(
anyObject
());
verify
(
userService
).
getEmployeeRoles
();
}
}
@Test
@Test
public
void
testdeleteEmployee
()
throws
Exception
{
public
void
testgetEmployeeRoleData
()
throws
Exception
{
mockMvc
.
perform
(
delete
(
"/user/deleteEmployee"
).
param
(
"empId"
,
"16127"
))
EmployeeRoles
employeesRole
=
new
EmployeeRoles
(
"5976ef15874c902c98b8a05d"
,
"16127"
,
null
,
null
,
null
,
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
new
Date
(
2017
-
11
-
13
),
new
Date
(
2017
-
12
-
20
));
verify
(
userService
).
deleteEmployee
(
"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"
)))
@Test
.
andDo
(
print
());
public
void
testgetUserRoles
()
throws
Exception
{
verify
(
userService
).
getEmployeesRoleData
(
"16127"
);
List
<
EmployeeRoles
>
employeesRole3
=
CreateUserRoles
();
}
when
(
userService
.
getEmployeeRoles
()).
thenReturn
(
employeesRole3
);
mockMvc
.
perform
(
get
(
"/user/getUserRoles"
)
@Test
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
public
void
testgetEmployeeRoleDataForEmailIdSearch
()
throws
Exception
{
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
EmployeeRoles
employeesRole
=
new
EmployeeRoles
(
"5976ef15874c902c98b8a05d"
,
"16209"
,
null
,
null
,
null
,
null
,
verify
(
userService
).
getEmployeeRoles
();
null
,
null
,
null
,
null
,
null
,
null
,
null
,
new
Date
(
2017
-
11
-
13
),
new
Date
(
2017
-
12
-
20
));
}
when
(
userService
.
getEmployeeRoleDataForSearchCriteria
(
"dummy@nisum.com"
,
"emailId"
)).
thenReturn
(
employeesRole
);
mockMvc
.
perform
(
get
(
"/user/getEmployeeRoleDataForSearchCriteria"
).
param
(
"searchId"
,
"dummy@nisum.com"
)
@Test
.
param
(
"searchAttribute"
,
"emailId"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
public
void
testgetEmployeeRoleData
()
throws
Exception
{
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
()).
andExpect
(
jsonPath
(
"$.employeeId"
,
is
(
"16209"
)))
EmployeeRoles
employeesRole
=
new
EmployeeRoles
(
.
andDo
(
print
());
"5976ef15874c902c98b8a05d"
,
"16127"
,
null
,
null
,
null
,
null
,
verify
(
userService
).
getEmployeeRoleDataForSearchCriteria
(
"dummy@nisum.com"
,
"emailId"
);
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
}
null
,
new
Date
(
2017
-
11
-
13
),
new
Date
(
2017
-
12
-
20
));
when
(
userService
.
getEmployeesRoleData
(
"16127"
))
@Test
.
thenReturn
(
employeesRole
);
public
void
testgetEmployeeRoleDataForEmployeeNameSearch
()
throws
Exception
{
mockMvc
.
perform
(
get
(
"/user/getEmployeeRoleData"
).
param
(
"empId"
,
"16127"
)
EmployeeRoles
employeesRole
=
new
EmployeeRoles
(
"5976ef15874c902c98b8a05d"
,
"16209"
,
null
,
null
,
null
,
null
,
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
null
,
null
,
null
,
null
,
null
,
null
,
null
,
new
Date
(
2017
-
11
-
13
),
new
Date
(
2017
-
12
-
20
));
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
when
(
userService
.
getEmployeeRoleDataForSearchCriteria
(
"Mahesh Kumar Gutam"
,
"employeeName"
)).
thenReturn
(
employeesRole
);
.
andExpect
(
jsonPath
(
"$.employeeId"
,
is
(
"16127"
)))
mockMvc
.
perform
(
get
(
"/user/getEmployeeRoleDataForSearchCriteria"
).
param
(
"searchId"
,
"Mahesh Kumar Gutam"
)
.
andDo
(
print
());
.
param
(
"searchAttribute"
,
"employeeName"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
verify
(
userService
).
getEmployeesRoleData
(
"16127"
);
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
()).
andExpect
(
jsonPath
(
"$.employeeId"
,
is
(
"16209"
)))
}
.
andDo
(
print
());
verify
(
userService
).
getEmployeeRoleDataForSearchCriteria
(
"Mahesh Kumar Gutam"
,
"employeeName"
);
@Test
}
public
void
testgetEmployeeRoleDataForEmailIdSearch
()
throws
Exception
{
EmployeeRoles
employeesRole
=
new
EmployeeRoles
(
@Test
"5976ef15874c902c98b8a05d"
,
"16209"
,
null
,
null
,
null
,
null
,
public
void
testGetEmployeeDetailsForAutocomplete
()
throws
Exception
{
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
List
<
String
>
details
=
new
ArrayList
<>();
null
,
new
Date
(
2017
-
11
-
13
),
new
Date
(
2017
-
12
-
20
));
details
.
add
(
"16294"
);
details
.
add
(
"Ashwin Kumar"
);
details
.
add
(
"kashwin@nisum.com"
);
when
(
userService
.
getEmployeeRoleDataForSearchCriteria
(
"dummy@nisum.com"
,
details
.
add
(
"16209"
);
details
.
add
(
"Mahesh Kumar Gutam"
);
details
.
add
(
"mgutam@nisum.com"
);
"emailId"
)).
thenReturn
(
employeesRole
);
details
.
add
(
"16143"
);
details
.
add
(
"Ajay"
);
details
.
add
(
"ajayS@nisum.com"
);
mockMvc
.
perform
(
get
(
"/user/getEmployeeRoleDataForSearchCriteria"
)
details
.
add
(
"16207"
);
details
.
add
(
"Sumith Kumar Lambu"
);
details
.
add
(
"slambu@nisum.com"
);
.
param
(
"searchId"
,
"dummy@nisum.com"
)
details
.
add
(
"16111"
);
details
.
add
(
"Mahesh Mudrakolu"
);
details
.
add
(
"mmahesh@nisum.com"
);
.
param
(
"searchAttribute"
,
"emailId"
)
when
(
userService
.
getEmployeeDetailsForAutocomplete
()).
thenReturn
(
details
);
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
mockMvc
.
perform
(
get
(
"/user/getEmployeeDetailsForAutocomplete"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
()).
andDo
(
print
());
.
andExpect
(
jsonPath
(
"$.employeeId"
,
is
(
"16209"
)))
verify
(
userService
).
getEmployeeDetailsForAutocomplete
();
.
andDo
(
print
());
}
verify
(
userService
).
getEmployeeRoleDataForSearchCriteria
(
"dummy@nisum.com"
,
"emailId"
);
@Test
}
public
void
testgetManagers
()
throws
Exception
{
List
<
EmployeeRoles
>
employeesRole4
=
CreateUserRoles
();
@Test
System
.
out
.
println
(
employeesRole4
);
public
void
testgetEmployeeRoleDataForEmployeeNameSearch
()
when
(
userService
.
getEmployeeRoles
()).
thenReturn
(
employeesRole4
);
throws
Exception
{
mockMvc
.
perform
(
get
(
"/user/getManagers"
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
EmployeeRoles
employeesRole
=
new
EmployeeRoles
(
verify
(
userService
).
getEmployeeRoles
();
"5976ef15874c902c98b8a05d"
,
"16209"
,
null
,
null
,
null
,
null
,
}
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
new
Date
(
2017
-
11
-
13
),
new
Date
(
2017
-
12
-
20
));
@Test
when
(
userService
.
getEmployeeRoleDataForSearchCriteria
(
public
void
testgetAllShifts
()
throws
Exception
{
"Mahesh Kumar Gutam"
,
"employeeName"
))
List
<
Shift
>
shifts
=
CreateShifts
();
.
thenReturn
(
employeesRole
);
when
(
userService
.
getAllShifts
()).
thenReturn
(
shifts
);
mockMvc
.
perform
(
get
(
"/user/getEmployeeRoleDataForSearchCriteria"
)
mockMvc
.
perform
(
get
(
"/user/getAllShifts"
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
.
param
(
"searchId"
,
"Mahesh Kumar Gutam"
)
verify
(
userService
).
getAllShifts
();
.
param
(
"searchAttribute"
,
"employeeName"
)
}
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
@Test
.
andExpect
(
jsonPath
(
"$.employeeId"
,
is
(
"16209"
)))
public
void
testgetAllDesignations
()
throws
Exception
{
.
andDo
(
print
());
List
<
Designation
>
designation
=
CreateDesignations
();
verify
(
userService
).
getEmployeeRoleDataForSearchCriteria
(
when
(
userService
.
getAllDesignations
()).
thenReturn
(
designation
);
"Mahesh Kumar Gutam"
,
"employeeName"
);
mockMvc
.
perform
(
get
(
"/user/getAllDesignations"
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
}
verify
(
userService
).
getAllDesignations
();
}
@Test
public
void
testGetEmployeeDetailsForAutocomplete
()
throws
Exception
{
@Test
List
<
String
>
details
=
new
ArrayList
<>();
public
void
testgetTechnologies
()
throws
Exception
{
details
.
add
(
"16294"
);
List
<
Skill
>
skills
=
CreateSkill
();
details
.
add
(
"Ashwin Kumar"
);
System
.
out
.
println
(
skills
);
details
.
add
(
"kashwin@nisum.com"
);
when
(
userService
.
getTechnologies
()).
thenReturn
(
skills
);
details
.
add
(
"16209"
);
mockMvc
.
perform
(
get
(
"/user/getSkills"
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
details
.
add
(
"Mahesh Kumar Gutam"
);
verify
(
userService
).
getTechnologies
();
details
.
add
(
"mgutam@nisum.com"
);
}
details
.
add
(
"16143"
);
details
.
add
(
"Ajay"
);
@Test
details
.
add
(
"ajayS@nisum.com"
);
public
void
testupdateProfile
()
throws
Exception
{
details
.
add
(
"16207"
);
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
));
details
.
add
(
"Sumith Kumar Lambu"
);
System
.
out
.
println
(
employeeRole
);
details
.
add
(
"slambu@nisum.com"
);
ObjectMapper
mapper
=
new
ObjectMapper
();
details
.
add
(
"16111"
);
String
jsonString
=
mapper
.
writeValueAsString
(
employeeRole
);
details
.
add
(
"Mahesh Mudrakolu"
);
System
.
out
.
println
(
jsonString
);
details
.
add
(
"mmahesh@nisum.com"
);
when
(
userService
.
updateProfile
(
anyObject
())).
thenReturn
(
employeeRole
);
when
(
userService
.
getEmployeeDetailsForAutocomplete
())
mockMvc
.
perform
(
post
(
"/user/updateProfile"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
).
content
(
jsonString
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
.
thenReturn
(
details
);
verify
(
userService
).
updateProfile
(
anyObject
());
mockMvc
.
perform
(
get
(
"/user/getEmployeeDetailsForAutocomplete"
)
}
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
@Test
.
andDo
(
print
());
public
void
getAccounts
()
throws
Exception
{
verify
(
userService
).
getEmployeeDetailsForAutocomplete
();
List
<
Account
>
account
=
CreateAccount
();
}
System
.
out
.
println
(
account
);
when
(
userService
.
getAccounts
()).
thenReturn
(
account
);
@Test
mockMvc
.
perform
(
get
(
"/user/getAccounts"
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
public
void
testgetManagers
()
throws
Exception
{
verify
(
userService
).
getAccounts
();
List
<
EmployeeRoles
>
employeesRole4
=
CreateUserRoles
();
}
System
.
out
.
println
(
employeesRole4
);
when
(
userService
.
getEmployeeRoles
()).
thenReturn
(
employeesRole4
);
private
List
<
Account
>
CreateAccount
()
{
mockMvc
.
perform
(
get
(
"/user/getManagers"
))
List
<
Account
>
data
=
new
ArrayList
<>();
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
getEmployeeRoles
();
Account
account1
=
new
Account
();
}
account1
.
setId
(
new
ObjectId
(
"5976ef15874c902c98b8a05d"
));
account1
.
setAccountId
(
"01"
);
@Test
account1
.
setAccountName
(
"GAP"
);
public
void
testgetAllShifts
()
throws
Exception
{
account1
.
setAccountProjectSequence
(
1
);
List
<
Shift
>
shifts
=
CreateShifts
();
account1
.
setStatus
(
"Active"
);
when
(
userService
.
getAllShifts
()).
thenReturn
(
shifts
);
data
.
add
(
account1
);
mockMvc
.
perform
(
get
(
"/user/getAllShifts"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
Account
account2
=
new
Account
();
verify
(
userService
).
getAllShifts
();
account2
.
setId
(
new
ObjectId
(
"2476ef15874c902c98b8a05d"
));
}
account2
.
setAccountId
(
"02"
);
account2
.
setAccountName
(
"MACYS"
);
@Test
account2
.
setAccountProjectSequence
(
2
);
public
void
testgetAllDesignations
()
throws
Exception
{
account2
.
setStatus
(
"Non-Active"
);
List
<
Designation
>
designation
=
CreateDesignations
();
data
.
add
(
account2
);
when
(
userService
.
getAllDesignations
()).
thenReturn
(
designation
);
return
data
;
mockMvc
.
perform
(
get
(
"/user/getAllDesignations"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
}
verify
(
userService
).
getAllDesignations
();
}
private
List
<
Skill
>
CreateSkill
()
{
List
<
Skill
>
data
=
new
ArrayList
<>();
@Test
public
void
testgetTechnologies
()
throws
Exception
{
Skill
skills1
=
new
Skill
();
List
<
Skill
>
skills
=
CreateSkill
();
skills1
.
setId
(
new
ObjectId
(
"5976ef15874c902c98b8a05d"
));
System
.
out
.
println
(
skills
);
skills1
.
setSkillId
(
"01"
);
when
(
userService
.
getTechnologies
()).
thenReturn
(
skills
);
skills1
.
setSkillName
(
"Java"
);
mockMvc
.
perform
(
get
(
"/user/getSkills"
))
skills1
.
setActiveStatus
(
"Active"
);
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
data
.
add
(
skills1
);
verify
(
userService
).
getTechnologies
();
}
Skill
skills2
=
new
Skill
();
skills2
.
setId
(
new
ObjectId
(
"2476ef15874c902c98b8a05d"
));
@Test
skills2
.
setSkillId
(
"02"
);
public
void
testupdateProfile
()
throws
Exception
{
skills2
.
setSkillName
(
"Big Data"
);
EmployeeRoles
employeeRole
=
new
EmployeeRoles
(
skills2
.
setActiveStatus
(
"Active"
);
"5996ef15874c902c98b8a05d"
,
"16127"
,
"Monika Srivastava"
,
data
.
add
(
skills2
);
"msrivastava@nisum.com"
,
"Employee"
,
"Software Engineer"
,
return
data
;
"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
);
private
List
<
Designation
>
CreateDesignations
()
{
ObjectMapper
mapper
=
new
ObjectMapper
();
List
<
Designation
>
data
=
new
ArrayList
<>();
String
jsonString
=
mapper
.
writeValueAsString
(
employeeRole
);
System
.
out
.
println
(
jsonString
);
Designation
desig1
=
new
Designation
();
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
()).
thenReturn
(
account
);
mockMvc
.
perform
(
get
(
"/user/getAccounts"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
getAccounts
();
}
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
.
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"
);
desig2
.
setActiveStatus
(
"Active"
);
desig2
.
setActiveStatus
(
"Active"
);
data
.
add
(
desig2
);
data
.
add
(
desig2
);
return
data
;
return
data
;
}
}
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"
);
shift2
.
setActiveStatus
(
"Active"
);
shift2
.
setActiveStatus
(
"Active"
);
data
.
add
(
shift2
);
data
.
add
(
shift2
);
return
data
;
return
data
;
}
}
private
List
<
EmployeeRoles
>
CreateUserRoles
()
{
private
List
<
EmployeeRoles
>
CreateUserRoles
()
{
List
<
EmployeeRoles
>
data
=
new
ArrayList
<>();
List
<
EmployeeRoles
>
data
=
new
ArrayList
<>();
EmployeeRoles
data1
=
new
EmployeeRoles
();
EmployeeRoles
data1
=
new
EmployeeRoles
();
data1
.
setId
(
"3976ef15874c902c98b8a05d"
);
data1
.
setId
(
"3976ef15874c902c98b8a05d"
);
data1
.
setEmployeeId
(
"16101"
);
data1
.
setEmployeeId
(
"16101"
);
data1
.
setEmployeeName
(
"Abc"
);
data1
.
setEmployeeName
(
"Abc"
);
data1
.
setEmailId
(
"user1@nisum.com"
);
data1
.
setEmailId
(
"user1@nisum.com"
);
data1
.
setRole
(
"HR"
);
data1
.
setRole
(
"HR"
);
data1
.
setDesignation
(
"Human Resource Manager"
);
data1
.
setDesignation
(
"Human Resource Manager"
);
data1
.
setShift
(
"09:00-06:00"
);
data1
.
setShift
(
"09:00-06:00"
);
data1
.
setBaseTechnology
(
"Spring"
);
data1
.
setBaseTechnology
(
"Spring"
);
data1
.
setTechnologyKnown
(
"Jmeter"
);
data1
.
setTechnologyKnown
(
"Jmeter"
);
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"
);
data2
.
setEmployeeId
(
"16102"
);
data2
.
setEmployeeId
(
"16102"
);
data2
.
setEmployeeName
(
"Xyz"
);
data2
.
setEmployeeName
(
"Xyz"
);
data2
.
setEmailId
(
"user2@nisum.com"
);
data2
.
setEmailId
(
"user2@nisum.com"
);
data2
.
setRole
(
"Manager"
);
data2
.
setRole
(
"Manager"
);
data2
.
setDesignation
(
"Senior Software Engineer"
);
data2
.
setDesignation
(
"Senior Software Engineer"
);
data2
.
setShift
(
"03:00-12:00"
);
data2
.
setShift
(
"03:00-12:00"
);
data2
.
setBaseTechnology
(
"Hibernate"
);
data2
.
setBaseTechnology
(
"Hibernate"
);
data2
.
setTechnologyKnown
(
"EJB"
);
data2
.
setTechnologyKnown
(
"EJB"
);
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
);
return
data
;
return
data
;
}
}
}
}
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