Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
Store-Producer
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
Mahesh Rohra
Store-Producer
Commits
0e22b472
Commit
0e22b472
authored
May 08, 2020
by
Simhadri Guntreddi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added component test case
parent
760e43e1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
TransactionControllerTest.java
...com/safeway/epe/controller/TransactionControllerTest.java
+26
-0
No files found.
src/test/java/com/safeway/epe/controller/TransactionControllerTest.java
View file @
0e22b472
...
@@ -69,6 +69,24 @@ public class TransactionControllerTest {
...
@@ -69,6 +69,24 @@ public class TransactionControllerTest {
Assertions
.
assertEquals
(
responseEntity
.
getBody
(),
Arrays
.
asList
(
new
Offsets
()));
Assertions
.
assertEquals
(
responseEntity
.
getBody
(),
Arrays
.
asList
(
new
Offsets
()));
}
}
@Test
public
void
testProducer_WhenIsProcessed_False
()
{
listOfOffest
=
new
ArrayList
<>();
Offsets
offsets
=
new
Offsets
();
offsets
.
setPartition
(
"0"
);
offsets
.
setOffset
(
"1"
);
listOfOffest
.
add
(
offsets
);
UUID
uuid
=
UUID
.
fromString
(
transactionId
);
Optional
<
TransactionRecorder
>
optionalOfferTransaction
=
Optional
.
of
(
createTransactionRecorderIsProcessedFalse
(
uuid
));
Mockito
.
when
(
transactionRepository
.
findById
(
Mockito
.
any
(
UUID
.
class
))).
thenReturn
(
optionalOfferTransaction
);
Mockito
.
when
(
producerService
.
produce
(
Mockito
.
any
(
TransactionPayload
.
class
),
Mockito
.
anyString
(),
Mockito
.
any
(
TransactionRecorder
.
class
),
Mockito
.
anyBoolean
())).
thenReturn
(
listOfOffest
);
ResponseEntity
<
List
<
Offsets
>>
responseEntity
=
transactionController
.
produce
(
transactionId
);
Assertions
.
assertEquals
(
responseEntity
.
getStatusCode
(),
HttpStatus
.
OK
);
}
private
TransactionRecorder
createTransactionRecorder
(
UUID
uuid
)
{
private
TransactionRecorder
createTransactionRecorder
(
UUID
uuid
)
{
TransactionRecorder
transactionRecorder
=
new
TransactionRecorder
();
TransactionRecorder
transactionRecorder
=
new
TransactionRecorder
();
transactionRecorder
.
setUuid
(
uuid
);
transactionRecorder
.
setUuid
(
uuid
);
...
@@ -77,5 +95,13 @@ public class TransactionControllerTest {
...
@@ -77,5 +95,13 @@ public class TransactionControllerTest {
transactionRecorder
.
setOfferTransactionResponse
(
"TransactionResponse"
);
transactionRecorder
.
setOfferTransactionResponse
(
"TransactionResponse"
);
return
transactionRecorder
;
return
transactionRecorder
;
}
}
private
TransactionRecorder
createTransactionRecorderIsProcessedFalse
(
UUID
uuid
)
{
TransactionRecorder
transactionRecorder
=
new
TransactionRecorder
();
transactionRecorder
.
setUuid
(
uuid
);
transactionRecorder
.
setProcessed
(
false
);
transactionRecorder
.
setOffers
(
"offers"
);
transactionRecorder
.
setOfferTransactionResponse
(
"TransactionResponse"
);
return
transactionRecorder
;
}
}
}
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