Adam Bien's Weblog

Mocking Without Interfaces [Screencast]

There is a common misconception about mandatory interfaces for easy unit testing and mocking. This myth causes a lot of plumbing in Java EE projects. This screencast shows how to mock classes directly--without any interfaces:

See also other screencasts at: or subscribe to

NEW workshop: Building HTML 5 Applications Without Frameworks, Full week in December 2016: from Java EE 7 Bootstrap, Effective, Architectures over Testing to Microservices
On demand workshops: Java EE 7: Bootstrap, Effective, Testing and Microservices available for streaming.


A book about rethinking Java EE Patterns


I use Mockite since 1 year now and I am very happy with it. Unfortunately Mockito cannot mock final classes and methods. Powermock is supposed to be able to mock final classes and methods but I did not try it out yet so I do not know if it has any additional drawbacks.

Posted by Christian on July 27, 2012 at 12:00 PM CEST #

Post a Comment:
  • HTML Syntax: NOT allowed
Online Workshops
...the last 150 posts
...the last 10 comments