Package cz.muni.fi.pa165.stis.entity

Examples of cz.muni.fi.pa165.stis.entity.User


  
    public void testInsertReservationWithIncorrectBorrowAttributes() {
        List<Book> reservationList = new ArrayList<Book>();
        reservationList.add(em.find(Book.class, new Long(1)));
        reservationList.add(em.find(Book.class, new Long(2)));
        Reservation incorrectReservation;
        long currentTime = System.currentTimeMillis();
        long afterMonth = currentTime + 2592000000l;
    }
View Full Code Here


        long afterMonth = currentTime + 2592000000l;
    }
  
    public void testInsertReservationWithIncorrectReaderID() {       
        try {
            reservationDAOImpl.insertReservation(new Reservation(em.find(Reader.class, new Long(-5)),
                                                 em.find(Book.class, new Long(1)), new Date(System.currentTimeMillis())));
            fail("Cannot insert reservation with reader's id lesser than or equals to 0");
        } catch (IllegalArgumentException ex) {
            // OK
        }
View Full Code Here

        }
    }
  
    public void testInsertReservationWithNullReaderID() {       
        try {
            reservationDAOImpl.insertReservation(new Reservation(null, em.find(Book.class, new Long(1)),
                                                 new Date(System.currentTimeMillis())));
            fail("Cannot insert reservation without reader's id");
        } catch (IllegalArgumentException ex) {
            // OK
        }
View Full Code Here

        }
    }
      
    public void testInsertReservationWithIncorrectBookID() { 
        try {
            reservationDAOImpl.insertReservation(new Reservation(em.find(Reader.class, new Long(1)),
                                                 em.find(Book.class, new Long(-5)), new Date(System.currentTimeMillis())));
            fail("Cannot insert reservation with book's id lesser than or equals to 0");
        } catch (IllegalArgumentException ex) {
            // OK
        }
View Full Code Here

        }
    }
      
    public void testInsertReservationWithNullBookID() { 
        try {
            reservationDAOImpl.insertReservation(new Reservation(em.find(Reader.class, new Long(1)),
                                                                 null, new Date(System.currentTimeMillis())));
            fail("Cannot make a reservation for book which is null");
        } catch (IllegalArgumentException ex) {
            // OK
        }
View Full Code Here

        }
    }
    
    public void testInsertReservationWithIncorrectReservationDate() {
        try {
            reservationDAOImpl.insertReservation(new Reservation(em.find(Reader.class, new Long(1)), em.find(Book.class, new Long(1)), null));
            fail("Cannot make a reservation without specifying a reservation date");
        } catch (IllegalArgumentException ex) {
            // OK
        }
      
View Full Code Here

      
    }
  
    public void testInsertCorrectReservation() { 
        em.getTransaction().begin();       
        Reservation reservation = new Reservation(em.find(Reader.class, new Long(1)),
                                   em.find(Book.class, new Long(8)), new Date(System.currentTimeMillis()));     
        em.persist(reservation);
        em.getTransaction().commit();
      
        assertNotNull(reservationDAOImpl.findReservationByID(reservation.getReservationID()));
      
        if (em != null) {
            em.close();
        }       
    }
View Full Code Here

        }       
    }
  
    public void testFindAllReservations() {
        em.getTransaction().begin();       
        Reservation reservation1 = new Reservation(em.find(Reader.class, new Long(1)),
                                   em.find(Book.class, new Long(8)), new Date(System.currentTimeMillis()));
        Reservation reservation2 = new Reservation(em.find(Reader.class, new Long(1)),
                em.find(Book.class, new Long(9)), new Date(System.currentTimeMillis()));
        em.persist(reservation1);
        em.persist(reservation2);       
        em.getTransaction().commit();
      
View Full Code Here

    }
  
    public void testFindReservationByID() {     
        em.getTransaction().begin();
      
        Reservation reservation1 = new Reservation(em.find(Reader.class, new Long(1)),
                em.find(Book.class, new Long(8)), new Date(System.currentTimeMillis()));
        Reservation reservation2 = new Reservation(em.find(Reader.class, 1l),
                em.find(Book.class, new Long(9)), new Date(System.currentTimeMillis()));
        em.persist(reservation1);
        em.persist(reservation2);
      
        em.getTransaction().commit();
      
        reservation1.setReservationID(new Long(1));
        reservation2.setReservationID(new Long(2));
      
        assertEquals(reservation1, reservationDAOImpl.findReservationByID(new Long(1)));
        assertEquals(reservation2, reservationDAOImpl.findReservationByID(new Long(2)));
      
        if (em != null) {
View Full Code Here

    }
  
    public void testFindReservationsByReader() {     
        em.getTransaction().begin();
      
        Reservation reservation1 = new Reservation(em.find(Reader.class, new Long(1)),
                em.find(Book.class, new Long(8)), new Date(System.currentTimeMillis()));
        Reservation reservation2 = new Reservation(em.find(Reader.class, new Long(1)),
                em.find(Book.class, new Long(9)), new Date(System.currentTimeMillis()));
        em.persist(reservation1);
        em.persist(reservation2);
      
        em.getTransaction().commit();
View Full Code Here

TOP

Related Classes of cz.muni.fi.pa165.stis.entity.User

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.