import junit.framework.TestCase; /** A JUnit test case class for the ObjectList composite classes. */ public class ObjectListTest extends TestCase { static ObjectList E = EmptyObjectList.ONLY; static ObjectList l1 = E.cons(17); // '(17) static ObjectList l2 = l1.cons(5); // '(5 17) static ObjectList l3 = E.cons(5); // '(5) static ObjectList l5 = l3.cons(17); // '(17 5) static ObjectList l6 = l5.cons(-5).cons(100).cons(50); // '(50 100 -5 17 5) /** Tests the listString method. */ void testListString() { assertEquals("empty listString", "()", E.listString()); assertEquals("(17) listString", "(17)", l1.listString()); assertEquals("(5 17) listString", "(5 17)", l2.listString()); assertEquals("(50 100 -5 17 5) test", "(50 100 -5 17 5)", l6.listString()); } }