Re: Require clarification where JUnit can be used and how?
Posted By:
ankush_purwar
Posted On:
Friday, February 3, 2006 05:11 PM
Junit can't check the intermediate objects in your method.
And of course it shouldn't.
I think you have forgot what JUnit provides.
Basically it provides a unit testing framework to test your API's.And before writing test case you need to know only things that the API you are going to test, What it is supposed to do.
How it does it is out of the scope of Junit ?
Re: Require clarification where JUnit can be used and how?
Posted By:
Anonymous
Posted On:
Friday, February 3, 2006 08:11 AM
Junit helps to check the function namely addVertex here, by
passing some values to its arguments and checking its
returned value.
eg,
Assume the above method in class X,
public void testAddVertex(){
X x = new X();
int actualResult = x.addVertex("hi","hello");
int exceptedResult ="HI" ;
Assert.equals(exceptedResult,actualResult);
}
if actualResult and exceptedResult are same, then the test
is passed , if not same it throws AssertFailedError