Junit assertEquals
1 posts in topic
Flat View  Flat View

Posted By:   rama_krishna
Posted On:   Monday, January 21, 2008 09:32 PM

I want to compare two object in assertEquals
There is a class "DataTest" with three variables(2 Integer and one int)

DataTest {
Integer x,y;
int z;
DataTest dataTest = new DataTest();
assertEquals(new Integer(0),dataTest.getX()); //line1
assertEquals(new Integer(0),dataTest.getY()); //line2
assertEquals(new Integer(0),dataTest.getz());

This test fails at line1 and line2. Why???

Re: Junit assertEquals

Posted By:   Anonymous  
Posted On:   Monday, January 28, 2008 04:04 PM

when you are using Integer object inside your DataTest object, theire defualt values are null, not zero, so line 1 and 2 fails...

About | Sitemap | Contact