Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

junit.framework.AssertionFailedError -HELP!!!

807597Mar 16 2005 — edited Mar 16 2005
Hi
I'm getting this error while tseting.
here's part of the code :
public void testGetScore()
	{
		boolean res=false;
		int[] expectedscore = new int[2];
		expectedscore[0]=1;
		expectedscore[0]=2;
		ComputeScore.getScore();
		int[] actualscore = GameDataModel.getScore();
		for(int i=0;i<2;i++)
		{
			System.out.println("valus is : " +actualscore);
}

assertEquals(expectedscore[0],actualscore[0]);
assertEquals(expectedscore[1],actualscore[1]); //failed

}



the values in actualscore and expected are the same -
just before asserting also i printed out the values in actualvalue array and it gives 1,2.
but even then the assertion fails !!!

where have i gone wrong ?

the error msg is :

junit.framework.AssertionFailedError:expected:<2>but was:<1>
at .........my pkg name
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke0(unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Unknown Source)

Thanks!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 13 2005
Added on Mar 16 2005
2 comments
402 views