Guest User

Untitled

a guest
May 21st, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. package mockolate
  2. {
  3. import flash.display.MovieClip;
  4. import flash.events.Event;
  5.  
  6. import org.flexunit.assertThat;
  7. import org.flexunit.async.Async;
  8. import org.hamcrest.core.not;
  9. import org.hamcrest.object.isFalse;
  10. import org.hamcrest.object.isTrue;
  11. import org.hamcrest.object.nullValue;
  12.  
  13. public class UsingFlashClasses
  14. {
  15. [Test(async, timeout=10000)]
  16. public function prepareMovieClip():void
  17. {
  18. Async.handleEvent(this,
  19. prepare(MovieClip),
  20. Event.COMPLETE, prepareComplete, 10000);
  21. }
  22.  
  23. public function prepareComplete(event:Event, data:Object):void
  24. {
  25. var movieClip:MovieClip = nice(MovieClip);
  26. assertThat(movieClip, not(nullValue()));
  27.  
  28. mock(movieClip).method('willTrigger').args(Event.COMPLETE).returns(true);
  29. mock(movieClip).method('willTrigger').args(Event.CANCEL).returns(false);
  30.  
  31. assertThat(movieClip.willTrigger(Event.COMPLETE), isTrue());
  32. assertThat(movieClip.willTrigger(Event.CANCEL), isFalse());
  33.  
  34. verify(movieClip);
  35. }
  36. }
  37. }
Add Comment
Please, Sign In to add comment