Posted By:
learner_java
Posted On:
Friday, July 11, 2003 07:37 AM
HI all! I created a class as follow, HomeWork.class: package junit.samples; // Imports import junit.framework.Test; import junit.framework.TestCase; public class HomeWork extends TestCase { // Constructors public HomeWork() { } // Methods public static void main(String[] stringArray) { } public static Test suite() { return null;} public void testEmptyCollection() { } } and HomeWork.java as below: package junit.samples; import java.util.*; import jun
More>>
HI all!
I created a class as follow, HomeWork.class:
package junit.samples;
// Imports
import junit.framework.Test;
import junit.framework.TestCase;
public class HomeWork extends TestCase {
// Constructors
public HomeWork() { }
// Methods
public static void main(String[] stringArray) { }
public static Test suite() { return null;}
public void testEmptyCollection() { }
}
and HomeWork.java as below:
package junit.samples;
import java.util.*;
import junit.framework.*;
public class HomeWork extends TestCase {
public void testEmptyCollection() {
Collection collection = new ArrayList();
assertTrue(collection.isEmpty());
}
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTest(new HomeWork("testEmptyCollection")
{ protected void runTest() { testEmptyCollection(); }
}
);
return suite;
}
public static void main(String args[]) {
junit.swingui.TestRunner.run(suite());
}
}
I place it in C:junit3junit directory
and run as follow command:
at c:>java swingui.TestRunner junit.samples.Homework
and I got error "Bad magic number"
Please help me !! I dont know why??? thanks
<<Less