Examples of DataAccessException


Examples of org.springframework.dao.DataAccessException

    }
   
    @Test(expected = DataAccessException.class)
    public void testInsertReservationWithIncorrectReservationDate() {
        when(reservation1TO.getReservationDate()).thenReturn(null);
        when(mockReservationDAO.insertReservation(reservation1)).thenThrow(new DataAccessException("Incorrect reservation date") {});
       
        reservationService.insertReservation(reservation1TO);
    }
View Full Code Here

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

Examples of org.springframework.dao.DataAccessException

        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

Examples of org.springframework.dao.DataAccessException

        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

Examples of org.springframework.dao.DataAccessException

        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

Examples of org.springframework.dao.DataAccessException

    }
   
    @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

Examples of org.springframework.dao.DataAccessException

    }
   
    @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

Examples of org.springframework.dao.DataAccessException

    }
   
    @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

Examples of org.springframework.dao.DataAccessException

    }
   
    @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

Examples of sg.edu.nus.iss.se07.common.DataAccessException

                                FileUtil.writeContents(bw, data);
                        } else {
                                throw new IOException("[ProductDA::writeData]Failed to create filename " + fileName);
                        }
                } catch (IOException ex) {
                        throw new DataAccessException(ex.getMessage(), ex);
                } finally {
                        try {
                                if (bw != null) {
                                        bw.close();
                                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.