Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Vaadin 7 Cookbook
  • Table Of Contents Toc
Vaadin 7 Cookbook

Vaadin 7 Cookbook

By : Jaroslav Holan, Ondrej Kvasknovsky
4.3 (9)
close
close
Vaadin 7 Cookbook

Vaadin 7 Cookbook

4.3 (9)
By: Jaroslav Holan, Ondrej Kvasknovsky

Overview of this book

This is a cookbook with easy-to-follow recipes containing practical and detailed examples which are all fully backed up with code, illustrations, and tips. Vaadin 7 Cookbook is for developers who want to create Rich Internet Applications with Vaadin. Both newcomers to Vaadin and those who have some experience with it will find recipes to expand their working knowledge of Vaadin.
Table of Contents (19 chapters)
close
close
Vaadin 7 Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
1
Index

Unit testing in an MVP pattern


Unit tests are testing code without any outside dependencies. The outside dependencies are usually mocked by framework such as, in this recipe, Mockito (https://code.google.com/p/mockito).

In this recipe, we will demonstrate testability of the MVP pattern, so we will write unit tests for the presenter and view. We will utilize the LoginPresenter, UserService, LoginView, LoginViewHandler, and LoginViewImpl classes from the Login form with Model View Presenter recipe.

Getting ready

Get the code from the Login form with Model View Presenter recipe.

How to do it...

Perform the following steps:

  1. Create the LoginViewImplTest class inside the test folder:

    public class LoginViewImplTest { }
  2. Before we start testing, we need to set up the environment for running a unit test. Put the following code inside the LoginViewImplTest class:

        private LoginView view;
        private LoginViewHandler handler;
    
        @Before
        public void setUp() {
            view = new LoginViewImpl();
       ...
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Vaadin 7 Cookbook
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon