1 25 26 package org.objectweb.jonas.jtests.clients.entity; 27 28 import java.text.DateFormat ; 29 import java.text.SimpleDateFormat ; 30 import java.util.Calendar ; 31 import java.util.Date ; 32 33 import junit.framework.Assert; 34 35 import org.objectweb.jonas.jtests.beans.ebasic.BDate; 36 import org.objectweb.jonas.jtests.beans.ebasic.BDateHome; 37 import org.objectweb.jonas.jtests.util.JTestCase; 38 39 45 public abstract class A_PKDate extends JTestCase { 46 47 public A_PKDate(String name) { 48 super(name); 49 } 50 51 protected void setUp() { 52 super.setUp(); 53 useBeans("ebasic", true); 54 } 55 56 59 abstract public BDateHome getBDateHome(); 60 61 62 63 66 public void testPkDateCreate() throws Exception { 67 Date d = null; 68 Calendar date = Calendar.getInstance(); 69 date.set(2003,02,25); 70 d = date.getTime(); 71 DateFormat df = new SimpleDateFormat ("MM/dd/yyyy"); 72 BDate bd = getBDateHome().create(100,200, d); 73 Assert.assertEquals("Date ", df.format(d) , df.format(bd.getField3())); 74 75 bd.remove(); 77 78 } 79 80 83 public void testPkDateFindByPrimaryKey() throws Exception { 84 Date d = null; 85 Calendar date = Calendar.getInstance(); 86 date.set(2003,02,26); 87 DateFormat df = new SimpleDateFormat ("MM/dd/yyyy"); 88 d = date.getTime(); 89 BDate bd1 = getBDateHome().create(0,1, d); 90 BDate bd2 = getBDateHome().findByPrimaryKey(d); 91 Assert.assertEquals("Date", df.format(d) , df.format(bd2.getField3())); 92 bd1.remove(); 94 } 95 96 97 } 98 | Popular Tags |