Unit
the smallest testable piece of code
TDD
Test-Driven Development: a way of developing code which begins with a test, and then writing the minimum amount of code to fulfill that test. Each test should bring you closer and closer to the overall goal
Why do we use TDD?
Reduces waste, you only write bare minimum code necessary; makes it easier to plan, forced to plan what code should do rather than writing it as it comes. You create less error prone code on average
Unit testing
verifying all of smallest testable pieces of code (units) are working in isolation
What does the assert statement do?
sets criteria for whether test passes
Mockito
testing framework used to create mock objects
Why do we use Mockito?
test classes with dependencies in isolation
What is a mock object?
a fake version of an object whose behavior can be precisely controlled
What is verify?
state-based testing vs behavioral testing; verify is used to make sure your class is interacting correctly with its dependencies; you can only verify on mock objects