Question on JUNIT
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Wednesday, August 30, 2006 11:20 PM


Hi, I am a Junit greenhorn and I just want to ask if it is possible to test two or more classes on the same Junit test class.

Re: Question on JUNIT

Posted By:   Anonymous  
Posted On:   Thursday, August 31, 2006 09:45 AM

Sure - it's recommended to have a test class for each class-to-test (MyClass + MyClassTest). But you could do more tests in one test class:

public TwoClassesTest extends ... {
public void testMethodOfClassOne() {
One toTest = new One();
assertTrue( toTest.isOk() );
}
public void testMethodOfClassTwo() {
Two toTest = new Two();
assertTrue( "ok".equals(toTest.methodOfTwo()= );
}
}
About | Sitemap | Contact