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
Expand all
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 {
mockMvc
=
MockMvcBuilders
.
standaloneSetup
(
projectController
).
build
();
}
@Test
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
));
when
(
userService
.
getEmployeesRole
(
"user@nisum.com"
)).
thenReturn
(
employeesRole
);
mockMvc
.
perform
(
get
(
"/project/employee"
).
param
(
"emailId"
,
"user@nisum.com"
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
public
void
testgetEmployeeRole
()
throws
Exception
{
EmployeeRoles
employeesRole
=
new
EmployeeRoles
(
"5976ef15874c902c98b8a05d"
,
null
,
null
,
"user@nisum.com"
,
null
,
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"
);
}
@Test
public
void
testaddProject
()
throws
Exception
{
public
void
testaddProject
()
throws
Exception
{
List
<
String
>
list
=
new
ArrayList
<>();
list
.
add
(
"16101"
);
list
.
add
(
"16102"
);
list
.
add
(
"16103"
);
Project
employeeRole1
=
new
Project
(
new
ObjectId
(
"9976ef15874c902c98b8a05d"
),
"102"
,
"OMS"
,
"16101"
,
"Srikanth"
,
"Macys"
,
"Billable"
,
list
);
String
jsonvalue
=(
new
ObjectMapper
()).
writeValueAsString
(
employeeRole1
).
toString
();
Account
account
=
new
Account
(
new
ObjectId
(
"5a4f03661dca211ea7f94c02"
),
"2"
,
"Macys"
,
0
,
"Y"
);
when
(
projectService
.
addProject
(
employeeRole1
)).
thenReturn
(
employeeRole1
);
Project
employeeRole1
=
new
Project
(
new
ObjectId
(
"9976ef15874c902c98b8a05d"
),
"102"
,
"OMS"
,
"16101"
,
"Srikanth"
,
"Macys"
,
"Billable"
,
list
);
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
);
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
public
void
testupdateEmployeeRole
()
throws
Exception
{
public
void
testupdateEmployeeRole
()
throws
Exception
{
List
<
String
>
list1
=
new
ArrayList
<>();
list1
.
add
(
"16104"
);
list1
.
add
(
"16105"
);
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
();
String
jsonString
=
mapper
.
writeValueAsString
(
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
());
}
@Test
public
void
testdeleteProject
()
throws
Exception
{
mockMvc
.
perform
(
delete
(
"/project/deleteProject"
).
param
(
"projectId"
,
"101"
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
public
void
testdeleteProject
()
throws
Exception
{
mockMvc
.
perform
(
delete
(
"/project/deleteProject"
).
param
(
"projectId"
,
"101"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
projectService
).
deleteProject
(
"101"
);
}
@Test
public
void
testgetProjects
()
throws
Exception
{
public
void
testgetProjects
()
throws
Exception
{
List
<
Project
>
projects
=
CreateProjectDetails
();
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
();
}
@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
));
when
(
userService
.
getEmployeesRoleData
(
"16127"
)).
thenReturn
(
employeesRole
);
mockMvc
.
perform
(
get
(
"/project/getEmployeeRoleData"
).
param
(
"empId"
,
"16127"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
public
void
testgetEmployeeRoleData
()
throws
Exception
{
EmployeeRoles
employeesRole
=
new
EmployeeRoles
(
"5976ef15874c902c98b8a05d"
,
"16127"
,
null
,
null
,
null
,
null
,
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"
);
}
private
List
<
Project
>
CreateProjectDetails
()
{
List
<
Project
>
data
=
new
ArrayList
<>();
...
...
@@ -132,7 +158,6 @@ public class ProjectControllerTest {
list
.
add
(
"16103"
);
data1
.
setEmployeeIds
(
list
);
Project
data2
=
new
Project
();
data2
.
setId
(
new
ObjectId
(
"9976ef15874c902c98b8a05d"
));
data2
.
setProjectId
(
"102"
);
...
...
src/test/java/com/nisum/mytime/controllertest/ProjectTeamControllerTest.java
View file @
963f6644
This diff is collapsed.
Click to expand it.
src/test/java/com/nisum/mytime/controllertest/UserControllerTest.java
View file @
963f6644
This diff is collapsed.
Click to expand it.
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