Adam Bien's Weblog

Thursday Jul 26, 2012

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: http://tv.adam-bien.com or subscribe to http://www.youtube.com/user/bienadam.


Special Events: Java 8 with Java EE 7: "More Power with Less Code", 13th October, 2014 and Java EE 7: "Testing and Code Quality", 14th October, 2014

A book about rethinking Java EE Patterns

Comments:

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
realworldpatterns.com
...the last 150 posts
...the last 10 comments
Links
License