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.

Test2f.java 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 Common Public License v1.0
  6. * which accompanies this distribution and is available at
  7. * http://www.eclipse.org/legal/cpl-v10.html
  8. *
  9. * Contributors:
  10. * PARC initial implementation
  11. * ******************************************************************/
  12. package tests;
  13. import figures.*;
  14. import junit.framework.*;
  15. public class Test2f extends Test {
  16. public Test2f(String name) { super(name); }
  17. public static void main(String[] args) {
  18. junit.textui.TestRunner.run(Test2f.class);
  19. }
  20. public void setUp() {
  21. super.setUp();
  22. }
  23. public void testEasy() {
  24. Box sq = new Box(0, 0, 10, 10);
  25. sq.move(5,5);
  26. assertEquals(sq.getP0().getX(), 5);
  27. assertEquals(sq.getP0().getY(), 5);
  28. try {
  29. sq.getP0().setX(100);
  30. sq.getP1();
  31. fail("should have thrown IllegalStateException");
  32. } catch (IllegalStateException e) { }
  33. }
  34. }