OK. If I have code like this:

  | @Entity
  | public class Hotel implements Serializable
  | {
  | ...
  | @PrePersist
  | public void initialiseRank(){
  |  int rank= caculate(a+b+c);
  |   setRank(rank);
  | }
  | 
  | @PreUpdate
  | public void generateHistoryRecord(){
  |  save(getOriginalRecord())
  | }
  | 
  | @PreUpdate
  | public void caculateRank(){
  |  int rank= x + y + z;
  |   setRank(rank);
  | }
  | 
  | }
  | 

my integration testing code would look like this:

  | Hotel hotel= new Hotel(name);
  | em.persist(hotel);
  | ...
  | Hotel savedHotel=em.find(Hotel.class, id);
  | assert checkHotelRank(savedHotel);
  | 
  | savedHotel.getFeedbacks().add(feedback);
  | em.persist(savedHotel);
  | ...
  | assert checkHotelRank(savedHotel);
  | assert checkHotelHistory(savedHotel);
  | 

As you can see, my testing code uses EntityManager. How would you write your 
test for this scenario without EntityManager?


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3934629#3934629

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3934629


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to