Package org.springframework.dao

Examples of org.springframework.dao.DataAccessException


        assertEquals(reservation1TO, reservationService.findReservationByID(1l));
    }
   
    @Test(expected = DataAccessException.class)
    public void testFindReservationByNullID() {
        when(mockReservationDAO.findReservationByID(null)).thenThrow(new DataAccessException("Null reservation ID") {});
       
        reservationService.findReservationByID(null);
    }
View Full Code Here


        reservationService.findReservationByID(null);
    }
   
    @Test(expected = DataAccessException.class)
    public void testFindReservationByIncorrectID() {
        when(mockReservationDAO.findReservationByID(new Long(-100))).thenThrow(new DataAccessException("Incorrect reservation ID") {});
       
        reservationService.findReservationByID(new Long(-100));
    }
View Full Code Here

        assertEquals(null, reservationService.findReservationByID(1l));
    }
   
    @Test(expected = DataAccessException.class)
    public void testDeleteNullReservation() {
        when(mockReservationDAO.deleteReservation(null)).thenThrow(new DataAccessException("Null reservation") {});
       
        reservationService.deleteReservation(null);
    }
View Full Code Here

        when(DTOConvertor.convertReaderEntityListToTOList(readers)).thenReturn(readersTO);
    }
       
    @Test(expected=DataAccessException.class)
    public void testCreateNullReader() {
        when(readerDAO.createReader(null)).thenThrow(new DataAccessException("null argument") {});
        readerService.createReader(null);
    }
View Full Code Here

    }
   
    @Test(expected=DataAccessException.class)
    public void testCreateReaderWrongName() {
        when(reader.getFirstName()).thenReturn(null);
        when(readerDAO.createReader(reader)).thenThrow(new DataAccessException("null reader name") {});
        readerService.createReader(readerTO);
       
        when(reader.getFirstName()).thenReturn("");
        when(readerDAO.createReader(reader)).thenThrow(new DataAccessException("empty reader name") {});
        readerService.createReader(readerTO);
    }
View Full Code Here

    }
   
    @Test(expected=DataAccessException.class)
    public void testCreateReaderWrongLastname() {
        when(reader.getSurname()).thenReturn(null);
        when(readerDAO.createReader(reader)).thenThrow(new DataAccessException("null reader surname") {});
        readerService.createReader(readerTO);
     
        when(reader.getFirstName()).thenReturn("");
        when(readerDAO.createReader(reader)).thenThrow(new DataAccessException("empty reader surname") {});
        readerService.createReader(readerTO);
    }
View Full Code Here

    }
   
    @Test(expected=DataAccessException.class)
    public void testCreateReaderWrongBirthNumber() {
        when(reader.getBirthNumber()).thenReturn(null);
        when(readerDAO.createReader(reader)).thenThrow(new DataAccessException("null birth number") {});
        readerService.createReader(readerTO);
     
        when(reader.getBirthNumber()).thenReturn("");
        when(readerDAO.createReader(reader)).thenThrow(new DataAccessException("empty birth number") {});
        readerService.createReader(readerTO);
    }
View Full Code Here

    }
   
    @Test(expected=DataAccessException.class)
    public void testCreateReaderWrongAddress() {
        when(reader.getAddress()).thenReturn(null);
        when(readerDAO.createReader(reader)).thenThrow(new DataAccessException("null address") {});
        readerService.createReader(readerTO);
     
        when(reader.getAddress()).thenReturn("");
        when(readerDAO.createReader(reader)).thenThrow(new DataAccessException("empty address") {});
        readerService.createReader(readerTO);
    }
View Full Code Here

    }
   
    @Test(expected=DataAccessException.class)
    public void testCreateReaderWrongEmail() {
        when(reader.getEmail()).thenReturn(null);
        when(readerDAO.createReader(reader)).thenThrow(new DataAccessException("null email") {});
        readerService.createReader(readerTO);
     
        when(reader.getEmail()).thenReturn("");
        when(readerDAO.createReader(reader)).thenThrow(new DataAccessException("empty email") {});
        readerService.createReader(readerTO);
    }
View Full Code Here

        assertEquals(readersTO, readerService.findAllReaders());
    }
   
    @Test(expected=DataAccessException.class)
    public void testFindReaderByNullId() {
        when(readerDAO.findReaderById(null)).thenThrow(new DataAccessException("null reader id") {});
       
        readerService.findReaderById(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.