/** Test the copy constructor and the equals operator. */ public void testCopyConstructorAndEquals() { try { StringReader sr = new StringReader("Course()"); Lex lex = new Lex(sr); ExtendedNamedList2 namedList = new ExtendedNamedList2(lex); ExtendedNamedList2 namedList2 = new ExtendedNamedList2(namedList); assertTrue(namedList.equals(namedList2)); assertFalse(namedList == namedList2); sr = new StringReader("Day('abc')"); lex = new Lex(sr); namedList = new ExtendedNamedList2(lex); namedList2 = new ExtendedNamedList2(namedList); assertTrue(namedList.equals(namedList2)); assertFalse(namedList == namedList2); sr = new StringReader("XYZ(Name1, 'abc',\n Name3)"); lex = new Lex(sr); namedList = new ExtendedNamedList2(lex); namedList2 = new ExtendedNamedList2(namedList); assertTrue(namedList.equals(namedList2)); assertFalse(namedList == namedList2); } catch (ParserException e) { System.out.println( "ERROR in NamedListTest.testCreateNamedList2\n" + " should not get here.\n" + " error = " + e.getMessage()); } ; }