• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content

Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Like this presentation? Why not share!

Mockito (JUG Latvia)

on

  • 1,782 views

 

Statistics

Views

Total Views
1,782
Views on SlideShare
1,743
Embed Views
39

Actions

Likes
1
Downloads
63
Comments
0

3 Embeds 39

http://jujo00obo2o234ungd3t8qjfcjrs3o6k-a-sites-opensocial.googleusercontent.com 35
http://www.jug.lv 3
http://jugpreview.tumblr.com 1

Accessibility

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Mockito (JUG Latvia) Mockito (JUG Latvia) Presentation Transcript

    • Mockito JUG Latvia Denis Udod
    • Mochito vs Mockito
      • Mochito Recipe:
      •      1/12 liter Dark Rum
      •      3 cl Lemon Juice
      •      1/2 handful Mint
      •      1/12 liter Club Soda
      •      8 drops Angostura Bitters
      •     
    • Mochito vs Mockito
      • Mochito Recipe:
      •      1/12 liter Dark Rum
      •      3 cl Lemon Juice
      •      1/2 handful Mint
      •      1/12 liter Club Soda
      •      8 drops Angostura Bitters
      •     
      Mockito Recipe:      Java      Unit testing      Mock object
    • Mochito vs. Mockito
      • Mochito Recipe:
      •      1/12 liter Dark Rum
      •      3 cl Lemon Juice
      •      1/2 handful Mint
      •      1/12 liter Club Soda
      •      8 drops Angostura Bitters
      •     
      Mockito Recipe:      Java      Unit testing      Mock object What is the difference?
    • Mockito: Why drink it?
      • Q: What is unit testing? Q: What is a mock-objects? Q: Why do we mock-objects?
    • Unit testing - What's the point?
      • Write simple test for each class method.
    • Unit testing - What's the point?
      • Write simple test for each class method.
    • Unit testing - What's the point?
      • Write simple test for each class method.
    • Unit testing - What's the point?
      • Write simple test for each class method.
        • simple
        • fast
        • independent from "any" (database, network, filesystem)
    • Mock object - What's the point?
      • Simulate the behavior of complex, real(non-mock) objects.
        • Useful when a real object is impractical or impossible to incorporate into a unit test.
    • Mock object - What's the point?
      • Example - service object supplies non-deterministic results:
      •    
    • Mock object - What's the point?
      • Example - service object supplies non-deterministic results:
      •    
    • Mockito: Why drink it?
        • Mockito is a mocking framework that tastes really well.
        • It lets you write beautiful tests with clean & simple API. 
        • Mockito doesn't give you hangover.
    • Mockito: Why drink it?  
      • Syntax
        • Let’s keep it simple
        • No Strings for methods.
        • No anonymous inner classes.
        • Painless refactoring. Renaming a method should not break my tests.
    • Mockito: How to drink it?
        • Download from  http://mockito.org  
        • Add to project.
        • And have fun
    • Mockito: How to drink it?
      • Create mock object:
    • Mockito: How to drink it?
      • Create mock object:
    • Mockito: How to drink it?
      • Create mock object:
    • Mockito: How to drink it?
      • How about returned values?
    • Mockito: How to drink it?
      • How about returned values?
    • Mockito: How to drink it?
      • Check method invocations
    • Mockito: How to drink it?
      • Check method invocations
    • Mockito: How to drink it?
      • Check method invocations
    • Mockito: How to drink it?
      • Check method invocations
    • Mockito: How to drink it?
      • Check method invocations
    • Mockito: How to drink it?
      • Spying on real object:
    • Mockito: Hangover?
      • Limitation:
        • needs java 1.5+
        • Cannot mock final class
        • Cannot mock static, final methods
        • Cannot mock equals(),hashCode() metods
        • Cannot mock private metods
        • Cannot verify toString()
    • Mockito Who is your bartender?
      • Mockito is served to you by Szczepan Faber and friends.
      • www.mockito.org