Mockito - Verifying Mock Behavior in Java Unit Tests

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
3,271
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Dec 14, 2010

A screencast about Java Unit Testing. Shows how to verify mock objects using Mockito. http://www.canoo.com/blog for the full blog post. http://www.mockito.org to read the Mockito documentation.

Category:

Science & Technology

Tags:

License:

Standard YouTube License

  • likes, 0 dislikes

Link to this comment:

Share to:
see all

All Comments (6)

Sign In or Sign Up now to post a comment!
  • @comincho Complex systems are complex. If you're getting lost in how many dependencies your classes have % how much coupling your classes have, then it's a design smell and you need to look at refactoring. Of course, sometimes you can't avoid it or the alternatives are worse than the problem. This is why I prefer acceptance tests or integration tests better than unit tests. They are less fragile (but harder to make repeatable and automated). Summary: refactor first, then go to integration tests.

  • @ogourment I tried uploading to YouTube several times and each time it gave me all this extra time at the end of the video. Locally the video did not have all this blank space. It's too bad it happened, but it's not worth spending several hours tracking down a fix. Sorry :(

  • Difficult involved in mocking is what I can mock. You can mock concrete classes or interfaces, but in a real system with many services around... I get lost in what things I can mock. For example, I have a service with a method like createArticle(anActor, aPublicOffer, aProvider) where anActor is an instance of Actor, aPublicOffer is an instance of PublicOffer with a lot of properties, and go on. Sooner or later I have to go to DB. That's where I get lost, how mock could help me?

  • The last 9 minutes are the video equivalent of "this page intentionally left blank"? :-)

  • @jbarzilai1984 ha, too funny. yeah, it's hard to get easymock out of my head after using it for over 3 years. I say Spock at one point too, which is a groovy framework.

  • Wow, you say EasyMock instead of Mockito 3-4 times in each video.

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more