Supriya Ghosh (Editor)

EasyMock

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit
Developer(s)
  
Tammo Freese

Operating system
  
Cross-platform

Written in
  
Java

Type
  
Unit testing tool

Stable release
  
3.4 / 05 September 2015 (05 September 2015)

Repository
  
github.com/easymock/easymock

EasyMock is an open source testing framework for Java released under the Apache License. The framework allows the creation of test double objects for the purpose of Test-driven Development (TDD) or Behavior Driven Development (BDD).

Contents

A research performed in 2013 on 10,000 GitHub projects found that EasyMock is the 32th most popular Java library.

Distinguishing features

The EasyMock provides dynamically generated Mock objects (at runtime), without having to implement them. In EasyMock, the definition of Mock Object is differed from using an implemented Mock Object. Mock objects are built at run time and additional implementations cannot be defined for those objects.

Origin

EasyMock was created by Tammo Freese in 2001 (at OFFIS). Originally it allowed only mock interfaces with type safe mocking and additional features were added in later developments.

Usage

EasyMock can be an ideal solution for application with often-changing interfaces.

Example

Simple currency exchange program is provided here. An interface may look like as follows:

Implementation for a concrete class may look like as follows:

Sample implementation for a test class may look like as follows:

References

EasyMock Wikipedia