From: Haricharan R. <har...@ya...> - 2006-11-21 21:28:45
|
Hi All, =0A=0A I am new to JUnit-devel list. and this is my first quetion.= =0A=0AI have a class with a constructor, the constructor takes a file name= as an agriment and assignes it to a instance variable of the type String. = =0A=0AThis file name is later used in another method which when called will= open the file name as in the instance variable.=0A=0AThe class code looks = like this=0A=0Aclass ExClass =0A{=0A=0A private String FILENAME =3D null;= =0A=0A public ExClass(String FILENAME)=0A{=0A this.FILENAME =3D FILENAME= ;=0A}=0A=0A// Other methods ....=0A} =0A =0A=0ACan any one please giv= e suggestions to test this constructor.=0A=0A What I have right now is a = test case which trys to instantiate this class and verifies that an Object = is created. =0AI can think of the following cases. =0A=0A ExClass ExObj= =3D new ExClass("somefile.txt");=0A assertNotNull(ExObj);=0A=0A = [OR] =0A boolean flah =3D false;=0A try{=0A=0A = ExClass ExObj =3D new ExClass("somefile.txt");=0A }=0A catch (E= xception e) { flag =3D true; }=0A assertFalse(flag);=0A=0Athanks=0AHari= =0A=0A=0A =0A______________________________________________________________= ______________________=0ASponsored Link=0A=0ARates near 39yr lows. $420,000= Loan for $1399/mo. =0ACalcuate new payment. www.LowerMyBills.com/lre=0A |