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.

Test3b.java 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 support.Log;
  15. import junit.framework.*;
  16. import java.util.List;
  17. import java.util.Arrays;
  18. public class Test3b extends CoreTest {
  19. public static void main(String[] args) {
  20. junit.textui.TestRunner.run(Test3b.class);
  21. }
  22. public void testMovePointLog() {
  23. Point p1 = new Point(10, 100);
  24. Log.clear();
  25. p1.move(20, 30);
  26. List foundLog = Log.getData();
  27. List desiredLog =
  28. Arrays.asList(new String[] {
  29. "execution(void figures.Point.move(int, int)) at Point(10, 100)"
  30. });
  31. assertEquals(desiredLog, foundLog);
  32. }
  33. public void testMoveLineLog() {
  34. Point p1 = new Point(10, 100);
  35. Point p2 = new Point(20, 200);
  36. Line l = new Line(p1, p2);
  37. Log.clear();
  38. l.move(20, 30);
  39. List foundLog = Log.getData();
  40. List desiredLog =
  41. Arrays.asList(new String[] {
  42. "execution(void figures.Line.move(int, int)) at Line(Point(10, 100), Point(20, 200))",
  43. "execution(void figures.Point.move(int, int)) at Point(10, 100)",
  44. "execution(void figures.Point.move(int, int)) at Point(20, 200)"
  45. });
  46. assertEquals(desiredLog, foundLog);
  47. }
  48. }