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.

Test2a.java 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 Test2a extends CoreTest {
  16. public static void main(String[] args) {
  17. junit.textui.TestRunner.run(Test2a.class);
  18. }
  19. public void testTooSmall() {
  20. Point p1 = new Point(10, 100);
  21. try {
  22. p1.setX(-10);
  23. fail("should have thrown IllegalArgumentException");
  24. } catch (IllegalArgumentException ea) {
  25. }
  26. }
  27. public void testNotTooSmall() {
  28. Point p1 = new Point(10, 100);
  29. p1.setX(0);
  30. }
  31. public void testMove() {
  32. Line l1 = new Line(new Point(10, 100), new Point(20, 200));
  33. try {
  34. l1.move(-500, -500);
  35. fail("should have thrown IllegalArgumentException");
  36. } catch (IllegalArgumentException ea) {
  37. }
  38. }
  39. }