Commit 1f264c2e authored by Khalid Ali's avatar Khalid Ali
Browse files

Add findById notfound test

parent 73df0940
......@@ -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();
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment