EasyMock 4.0.1 is out!

This release adds a support of Java 9, 10 and 11. It also drops support of Java 6 and 7. So it is now a Java 8+. This brought easier maintenance and some performance improvement.

Modules are partly supported with an automatic module name.

If also changes the way EasyMock will determine the type of the returned mock. The idea is to solve a heavily annoying problem most mocking frameworks have with generics.

To be clear, starting now List<String> list = mock(List.class); will compile perfectly without any “unchecked” warning.

However, String s = mock(List.class); will also compile. But I’m expecting you not to be crazy enough to do such thing. It will do a ClassCastException at runtime anyway.

The only side effect is that in rare cases, the compiler might fail to infer the return type and give a compilation error. If it ever happen, the solution is to use a type witness, e.g. foo(EasyMock.<List<String>>mock(List.class). It should solve the problem nicely, and, again, without a warning.

Change log for Version 4.0.1 (2018-10-30)

Change log for Version 4.0 (2018-10-27)