class RandomShapeGenerator { private Random rand = new Random(); public Shape next(){ switch(rand.nextInt(3)){ default: case 0: return new Circle(); case 1: return new Square(); case 2: return new Triangle(); } } };
public class Shapes { private static Test monitor = new Test(); private static RandomShapeGenerator gen = new RandomShapeGenerator(); public static void main(String[] args) { Shape[] s = new Shape[9]; for (int i=0 ; i<s.length ; i++) { s[i] = gen.next(); } for (int i=0 ; i<s.length ; i++ ) { s[i].draw(); } monitor.expect(new Object[]{ new TestExpression("%% (Circle|Square|Triangle)"+"\\.draw\\(\\)",s.length) }); } }
then when i compile it said:
---------- Java Compiler ---------- Shapes.java:55: cannot resolve symbol symbol : class Test location: class Shapes private static Test monitor = new Test(); ^ Shapes.java:55: cannot resolve symbol symbol : class Test location: class Shapes private static Test monitor = new Test(); ^ Shapes.java:69: cannot resolve symbol symbol : class TestExpression location: class Shapes new TestExpression("%% (Circle|Square|Triangle)"+"\\.draw\\(\\)",s.length) ^ 3 errors
And i check the com/bruceeckel/simpletest and could not find the class Test . so where is it?