Android simple MVP demo with 100% Mockito test coverage
- What the Model View Presenter (MVP) Pattern is
- How a view interface is used to decouple the presenter from the UI Framework
- How the In memory user repository works in relation to the user repository (Repository Pattern)
- How to build a UserView interface and implement it on a Fragment, making the fragment the “V” in the MVP
- Build a Presenter (the “P” in MVP) based off a contract (interface)
- How to implement the interface in an implementation
- How to to rely on the UserView (the view) and UserRepository (repository pattern) abstractions (interfaces) instead of their concrete implementations
- How to have the presenter control all UI logic such as obtaining state, setting state, and UI messaging.
- How to inject the presenter interface through Dagger into the View (the fragment).
- How to wire up the presenter and the view together with the userPresenter#setView call.
- How the presenter takes over all orchestration during execution of the application with a live walkthrough of the running application code.
- How to write insanely fast unit tests within Android Studio with jUnit 4 and Mockito
- How to create mock objects with mockito
- How to create a simple mock interaction behavior
- How to completely decouple your presenter for test with no dependencies on Android, internet, databases and the like through mock objects and interfaces
- How to mock the repository layer
- How to mock the view layer
- What the @Before annotation in jUnit 4 is for and how it works
- How to use the mockito ‘when’ method to return values for given mock interactions
- How to use the ‘verify’ method to verify interactions on a mock
- How to use the ‘times(…)’ and ‘never’ method to verify that mock methods were (or were not) interacted with during the execution of the test
- How to use the built in Android Studio Code Coverage Tools
- How to expect exceptions to be thrown during the execution of a test
- How to use the built in Android Studio Code Coverage Tools
- How to get to 100% Code Coverage
- How and why the verify call needs a time(n) value when methods are called multiple times
- How field variables in a test can be used as a pass through to verify presenter actions on the model