Posted By:
Nikhil_Varma
Posted On:
Thursday, May 1, 2003 07:36 AM
I am having trouble running a simple JUNIT test.I get a AssertionFailedError: No tests found message.Here are the details... warning(junit.framework.TestSuite$1)junit.framework.AssertionFailedError: No tests found in junit.samples.shop.Pizza at junit.samples.shop.PizzaTest.main(PizzaTest.java:42) PizzaTest tests Pizza ------- Pizza code: package junit.samples.shop; import java.util.List; import java.util.LinkedList; public class Pizza { private List toppings; public Pizza(){
More>>
I am having trouble running a simple JUNIT test.I get a AssertionFailedError: No tests found message.Here are the details...
warning(junit.framework.TestSuite$1)junit.framework.AssertionFailedError: No tests found in junit.samples.shop.Pizza
at junit.samples.shop.PizzaTest.main(PizzaTest.java:42)
PizzaTest tests Pizza
-------
Pizza code:
package junit.samples.shop;
import java.util.List;
import java.util.LinkedList;
public class Pizza {
private List toppings;
public Pizza(){
toppings = new LinkedList();
}
public Pizza(List pToppings){
this.toppings = pToppings;
}
public List getToppings(){
return this.toppings;
}
}
-------
PizzaTest code:
package junit.samples.shop;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import junit.framework.Test;
import java.util.List;
public class PizzaTest extends TestCase{
public PizzaTest(String name){
super(name);
}
public void testToppingsOnNewPizza(){
Pizza pizza = new Pizza();
List toppings = pizza.getToppings();
assertTrue(toppings.size() == 0);
}
public static Test suite(){
TestSuite suite = new TestSuite(Pizza.class);
return suite;
}
public static void main(String args[]) {
junit.textui.TestRunner.run(suite());
}
}
<<Less