2. 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
3. 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
4. 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?
5. Mockito: Why drink it?
Q: What is unit testing?
Q: What is a mock-objects?
Q: Why do we mock-objects?
6. Unit testing - What's the point?
Write simple test for each class method.
7. Unit testing - What's the point?
Write simple test for each class method.
8. Unit testing - What's the point?
Write simple test for each class method.
9. Unit testing - What's the point?
Write simple test for each class method.
• simple
• fast
• independent from "any" (database, network, filesystem)
10. 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.
11. Mock object - What's the point?
Example - service object supplies non-deterministic results:
12. Mock object - What's the point?
Example - service object supplies non-deterministic results:
13. 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.
14. 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.