Book Image

Mockito Essentials

By : Sujoy Acharya
Book Image

Mockito Essentials

By: Sujoy Acharya

Overview of this book

Table of Contents (14 chapters)

Unit testing the GWT code


MVP's loose coupling enables rapid development, as the view implementation, server-side service implementation, and presenters are independent of each other. Hence, developers can concentrate on different areas of the application without stepping on each other, for instance, one can work on the server-side business logic, work on the presentation layer logic, and implement the view logic. View implementation doesn't contain any business logic other than UI components and layout information. So no JUnit test is required for the view implementation; only manual inspection is good enough. However, the presentation layer contains business logic, such as, a user cannot post a negative amount while making the payment for a bill or the payment amount cannot exceed the payable amount. Mockito plays a key role in mocking DOM widgets and stubbing widget behaviors. We'll refactor the DetailsPresenter class and extract the anonymous DOM click handler out of the constructor...