Book Image

Mockito Essentials

By : Sujoy Acharya
Book Image

Mockito Essentials

By: Sujoy Acharya

Overview of this book

Table of Contents (14 chapters)

Chapter 7. Unit Testing GWT Code with Mockito

"The secret of change is to focus all of your energy, not on fighting the old, but on building the new."

– Socrates

In today's world, Ajax plays an essential role in web application development. Google Web Toolkit (GWT) offers internationalization, cross-browser compatibility, Java coding, hosted mode for unit testing the client component in isolation from the server-side component, and so many things, for free. Unit testing the client-side business logic and building a JUnit safety net around the GWT code is very important for code quality and code maintenance. GWT code works with different Document Object Model (DOM) widgets and events; business logic gets tied up with the DOM widgets and events and makes it impossible to write unit test for the business logic. Mockito plays a key role in isolating the DOM widgets and events from the logic.

This chapter provides an overview of Ajax/GWT, explains the Model View Presenter (MVP) pattern and loose...