Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Khalid Ali
bookshare-backend
Commits
1f264c2e
Commit
1f264c2e
authored
Dec 17, 2018
by
Khalid Ali
Browse files
Add findById notfound test
parent
73df0940
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/test/java/com/gmu/bookshare/repository/ListingEntityRepositoryIntegrationTest.java
View file @
1f264c2e
...
...
@@ -68,4 +68,18 @@ public class ListingEntityRepositoryIntegrationTest {
assertThat
(
found1
.
isPresent
()).
isTrue
();
assertThat
(
found1
.
get
().
getId
()).
isEqualTo
(
book1
.
getId
());
}
@Test
public
void
whenFindByInvalidId_thenReturnEmpty
()
{
//given
ListingEntity
book1
=
new
ListingEntity
(
123456
,
3
,
14.99
,
new
Date
(),
192838079872L
,
2879878394L
,
"Title Calc 3"
);
testEntityManager
.
persistAndFlush
(
book1
);
// when
Optional
<
ListingEntity
>
error
=
listingRepository
.
findById
(
82341792L
);
// then
assertThat
(
error
.
isPresent
()).
isFalse
();
}
}
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