Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
ShoppingCartBackend
Project
Project
Details
Activity
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
snamdeo
ShoppingCartBackend
Commits
bfeb6d1b
Commit
bfeb6d1b
authored
Sep 06, 2022
by
snamdeo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Commiting after adding test cases to increase code coverage
parent
97983b66
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
4 deletions
+24
-4
UserDataControllerTest.java
...com/altimetrik/poc/controller/UserDataControllerTest.java
+24
-4
No files found.
src/test/java/com/altimetrik/poc/controller/UserDataControllerTest.java
View file @
bfeb6d1b
package
com
.
altimetrik
.
poc
.
controller
;
import
com.altimetrik.poc.dto.Customer
;
import
com.altimetrik.poc.dto.NewValetAmout
;
import
com.altimetrik.poc.dto.OrderDetails
;
import
com.altimetrik.poc.repository.UserLoggedInRepository
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.boot.test.mock.mockito.MockBean
;
import
static
org
.
mockito
.
Mockito
.
times
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertEquals
;
import
static
org
.
mockito
.
Mockito
.*;
import
static
org
.
mockito
.
Mockito
.
when
;
@SpringBootTest
...
...
@@ -20,10 +23,27 @@ public class UserDataControllerTest {
UserDataController
userDataController
;
@Test
public
void
remove
Products
(){
Customer
c
=
new
Customer
(
"Shishir"
,
"Namdeo"
,
"shishirnamdeo220@gmaik.com"
,
0
);
public
void
add
Products
(){
Customer
c
=
new
Customer
(
1
,
"Shishir"
,
"Namdeo"
,
"shishirnamdeo220@gmaik.com"
,
0
);
userDataController
.
addUser
(
c
);
verify
(
userLoggedInRepository
,
times
(
1
)).
save
(
c
);
}
@Test
public
void
getUserValetAmount
(){
Customer
c
=
new
Customer
(
1
,
"Shishir"
,
"Namdeo"
,
"shishirnamdeo220@gmaik.com"
,
0
);
when
(
userLoggedInRepository
.
findByReference
(
Customer
.
refer
)).
thenReturn
(
c
);
assertEquals
(
0
,
userDataController
.
getUserValetAmount
());
}
@Test
public
void
updateValetAmount
(){
Customer
c
=
new
Customer
(
1
,
"Shishir"
,
"Namdeo"
,
"shishirnamdeo220@gmaik.com"
,
0
);
when
(
userLoggedInRepository
.
findByReference
(
Customer
.
refer
)).
thenReturn
(
c
);
OrderDetails
pd
=
new
OrderDetails
(
300
,
3721
,
4356
,
6456
,
6565
,
454
,
667
,
new
Integer
[
43
],
new
Customer
());
userDataController
.
updateValetAmount
(
new
NewValetAmout
(
"123"
));
verify
(
userLoggedInRepository
,
times
(
1
)).
save
(
c
);
}
}
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