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 dates, new workshop: Java EE 7 Workshops: Bootstrap, Effective, Architectures, JavaScript Bootstrap and HTML 5 December, 7th-11th
NEW: Effective Java EE 7 -- 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