Package org.springframework.dao

Examples of org.springframework.dao.DataAccessException


        assertEquals(borrowTOList, borrowService.findAllBorrows());
    }
   
    @Test(expected=DataAccessException.class)
    public void testFindBorrowByNullID() {
        when(mockBorrowDao.findBorrowById(null)).thenThrow(new DataAccessException("null borrow id") {});
       
        borrowService.findBorrowByID(null);
    }
View Full Code Here


        borrowService.findBorrowByID(null);
    }
   
    @Test(expected=DataAccessException.class)
    public void testFindBorrowWithIllegalID() {
        when(mockBorrowDao.findBorrowById(-1l)).thenThrow(new DataAccessException("illegal id") {});
       
        borrowService.findBorrowByID(-1l);
    }
View Full Code Here

//        assertEquals(borrow1TO, borrowService.findBorrowByTitle(book1TO));
//    }
   
    @Test(expected=DataAccessException.class)
    public void testReturnBooksWithNullBorrowID() {
        when(mockBorrowDao.returnBooks(null, bookList)).thenThrow(new DataAccessException("null borrow id") {});
       
        borrowService.returnBooks(null, bookListTO);
    }
View Full Code Here

        borrowService.returnBooks(null, bookListTO);
    }
    @Test(expected=DataAccessException.class)
    public void testReturnBooksWithNullReturnList() {
        when(mockBorrowDao.returnBooks(borrow1, null)).thenThrow(new DataAccessException("null return list") {});
       
        borrowService.returnBooks(borrow1TO, null);
    }
View Full Code Here

    }
   
    @Test(expected=DataAccessException.class)
    public void testReturnBooksWithEmptyReturnList() {
        when(bookList.isEmpty()).thenReturn(true);
        when(mockBorrowDao.returnBooks(borrow1, bookList)).thenThrow(new DataAccessException("empty return list") {});
       
        borrowService.returnBooks(borrow1TO, bookListTO);
    }
View Full Code Here

        assertEquals(borrow1TO, borrowService.returnBooks(borrow1TO, bookListTO));
    }
   
    @Test(expected=DataAccessException.class)
    public void testDeleteBorrowWithNullID() {
        when(mockBorrowDao.deleteBorrow(null)).thenThrow(new DataAccessException("null borrow id") {});
       
        borrowService.deleteBorrow(null);
    }
View Full Code Here

        when(DTOConvertor.convertBookEntityListToTOList(books)).thenReturn(booksTO);
    }
       
    @Test(expected=DataAccessException.class)
    public void testCreateNullBook() {
        when(bookDao.createBook(null)).thenThrow(new DataAccessException("null argument") {});
        bookService.createBook(null);
    }
View Full Code Here

        bookService.createBook(null);
    }
   
    @Test(expected=DataAccessException.class)
    public void testCreateWrongBook() {
        when(bookDao.createBook(book)).thenThrow(new DataAccessException("incorrect parameters") {});
        bookService.createBook(bookTO);
    }
View Full Code Here

        assertEquals(booksTO, bookService.findAllBooks());
    }
   
    @Test(expected=DataAccessException.class)
    public void testFindBookWithWrongId() {
        when(bookDao.findBookById(new Long(-1))).thenThrow(new DataAccessException("illegal book id") {});
        bookService.findBookById(new Long(-1));
    }
View Full Code Here

        assertEquals(bookTO, bookService.findBookById(2l));
    }
   
    @Test(expected=DataAccessException.class)
    public void testDeleteNullBook() {
        doThrow(new DataAccessException("null book") {}).when(bookDao).deleteBook(null);
        bookService.deleteBook(null);
    }
View Full Code Here

TOP

Related Classes of org.springframework.dao.DataAccessException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.