changed the test namesas per Bdd convention

This commit is contained in:
rvsathe 2021-04-26 09:59:09 +05:30
parent f92573f298
commit 54277a0bfb
1 changed files with 3 additions and 3 deletions

View File

@ -24,21 +24,21 @@ public class HexagonalLibraryApplicationTest {
Book book; Book book;
@Test @Test
public void testInsertBook() { public void when_InsertBook_then_returnInteger() {
Mockito.when(libService.insertBook(bk)).thenReturn(1); Mockito.when(libService.insertBook(bk)).thenReturn(1);
int returnVal = libService.insertBook(bk); int returnVal = libService.insertBook(bk);
assertEquals(1, returnVal); assertEquals(1, returnVal);
} }
@Test @Test
public void testSearchBook() { public void when_SearchBook_then_returnBookObject() {
Book returnBook = new Book(); Book returnBook = new Book();
Mockito.lenient().when(libService.searchBook("Pride and Prejudice")).thenReturn(returnBook); Mockito.lenient().when(libService.searchBook("Pride and Prejudice")).thenReturn(returnBook);
assertNotNull(returnBook); assertNotNull(returnBook);
} }
@Test @Test
public void testGetAllBooks() { public void when_getAllBooks_then_returnListofBookObjects() {
List<Book> returnBookList = new ArrayList<Book>(); List<Book> returnBookList = new ArrayList<Book>();
returnBookList = libService.getAllBooks(); returnBookList = libService.getAllBooks();
assertNotNull(returnBookList); assertNotNull(returnBookList);