1 package org.hibernate.ce.auction.test; 2 3 import junit.framework.Test; 4 import junit.framework.TestSuite; 5 import junit.textui.TestRunner; 6 import org.hibernate.ce.auction.dao.UserDAO; 7 import org.hibernate.ce.auction.model.CreditCard; 8 import org.hibernate.ce.auction.model.CreditCardType; 9 import org.hibernate.ce.auction.model.User; 10 import org.hibernate.ce.auction.persistence.HibernateUtil; 11 12 public class UserTest extends TestCaseWithData { 13 14 16 public void testBillingDetails() throws Exception { 17 initData(); 18 19 UserDAO userDAO= new UserDAO(); 20 21 User user1 = userDAO.getUserById(u1.getId(), false); 22 23 CreditCard cc = 25 (CreditCard)HibernateUtil.getSession().load(CreditCard.class, user1.getDefaultBillingDetails().getId()); 26 assertEquals( cc.getType(), CreditCardType.MASTERCARD); 27 28 HibernateUtil.commitTransaction(); 29 HibernateUtil.closeSession(); 30 } 31 32 34 public UserTest(String x) { 35 super(x); 36 } 37 38 public static Test suite() { 39 return new TestSuite(UserTest.class); 40 } 41 42 public static void main(String [] args) throws Exception { 43 TestRunner.run( suite() ); 44 } 45 46 } 47 | Popular Tags |