T
TheSouthLondonSlasher
I have a simple JUnit4 test, which I want to run from a testSuite,
since obviously, later we'll have many tests. So my test is:
package test.gg.ba.util;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import com.gg.ba.util.Utility;
public class UtilityTest {
@Test
public void testCheckNull() {
assertEquals(Utility.checkNull("Ham"), false);
}
}
This is fine and dandy, and works well when I run as JUnit Test in
Eclipse. However, the Suite, I'm having trouble with:
package test;
import test.gg.ba.util.UtilityTest;
import junit.framework.Test;
import junit.framework.TestSuite;
public class AllTests {
public static Test suite() {
TestSuite suite = new TestSuite("Test for test");
//$JUnit-BEGIN$
suite.addTest(test.gg.ba.util.UtilityTest.class);
//$JUnit-END$
return suite;
}
}
The line suite.addTest tells me:
The method addTest(Test) in the type TestSuite is not applicable for
the arguments (Class <UtilityTest>).
I understand what this message means, but all of the examples I find
do it this way, so I do not understand what the mistake I am making
is.
Any help will be greatly appreciated! Thank you in advance.
since obviously, later we'll have many tests. So my test is:
package test.gg.ba.util;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import com.gg.ba.util.Utility;
public class UtilityTest {
@Test
public void testCheckNull() {
assertEquals(Utility.checkNull("Ham"), false);
}
}
This is fine and dandy, and works well when I run as JUnit Test in
Eclipse. However, the Suite, I'm having trouble with:
package test;
import test.gg.ba.util.UtilityTest;
import junit.framework.Test;
import junit.framework.TestSuite;
public class AllTests {
public static Test suite() {
TestSuite suite = new TestSuite("Test for test");
//$JUnit-BEGIN$
suite.addTest(test.gg.ba.util.UtilityTest.class);
//$JUnit-END$
return suite;
}
}
The line suite.addTest tells me:
The method addTest(Test) in the type TestSuite is not applicable for
the arguments (Class <UtilityTest>).
I understand what this message means, but all of the examples I find
do it this way, so I do not understand what the mistake I am making
is.
Any help will be greatly appreciated! Thank you in advance.