You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Test2c.java 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /* *******************************************************************
  2. * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
  3. * All rights reserved.
  4. * This program and the accompanying materials are made available
  5. * under the terms of the Eclipse Public License v1.0
  6. * which accompanies this distribution and is available at
  7. * http://www.eclipse.org/legal/epl-v10.html
  8. *
  9. * Contributors:
  10. * PARC initial implementation
  11. * ******************************************************************/
  12. package tests;
  13. import figures.*;
  14. import junit.framework.*;
  15. public class Test2c extends CoreTest {
  16. public static void main(String[] args) {
  17. junit.textui.TestRunner.run(Test2c.class);
  18. }
  19. public void testSelf() {
  20. Point p1 = new Point(10, 100);
  21. Group g = new Group(p1);
  22. try {
  23. g.add(g);
  24. fail("should have thrown IllegalArgumentException");
  25. } catch (IllegalArgumentException ea) {
  26. }
  27. }
  28. public void testNotSelf() {
  29. Point p1 = new Point(10, 100);
  30. Group g1 = new Group(p1);
  31. Group g2 = new Group(p1);
  32. g1.add(g2);
  33. }
  34. }