Update changelog.txt
1 file changed
tree: b83e9cbf0163f8099f3448d9cacdab6413a06694
  1. .github/
  2. api/
  3. classloading/
  4. core/
  5. examples/
  6. modules/
  7. reflect/
  8. release/
  9. src/
  10. tests/
  11. .gitignore
  12. .travis.yml
  13. changelog.txt
  14. generate_javadoc.sh
  15. LICENSE.txt
  16. pom.xml
  17. powermock.png
  18. README.md
README.md

PowerMock

Build Status Maven Central Javadoc Dependency Status

Usage status: Mockito: Reference Status Easymock: Reference Status jUnit: Reference Status TestNG Reference Status

Writing unit tests can be hard and sometimes good design has to be sacrificed for the sole purpose of testability. Often testability corresponds to good design, but this is not always the case. For example final classes and methods cannot be used, private methods sometimes need to be protected or unnecessarily moved to a collaborator, static methods should be avoided completely and so on simply because of the limitations of existing frameworks.

PowerMock is a framework that extends other mock libraries such as EasyMock with more powerful capabilities. PowerMock uses a custom classloader and bytecode manipulation to enable mocking of static methods, constructors, final classes and methods, private methods, removal of static initializers and more. By using a custom classloader no changes need to be done to the IDE or continuous integration servers which simplifies adoption. Developers familiar with the supported mock frameworks will find PowerMock easy to use, since the entire expectation API is the same, both for static methods and constructors. PowerMock aims to extend the existing API's with a small number of methods and annotations to enable the extra features. Currently PowerMock supports EasyMock and Mockito.

When writing unit tests it is often useful to bypass encapsulation and therefore PowerMock includes several features that simplifies reflection specifically useful for testing. This allows easy access to internal state, but also simplifies partial and private mocking.

Please note that PowerMock is mainly intended for people with expert knowledge in unit testing. Putting it in the hands of junior developers may cause more harm than good.

News

  • 2016-11-04: PowerMock 1.6.6 is released with bug fixes and other imporvements. See release notes and change log for details.
  • 2016-05-01: PowerMock 1.6.5 has been released with new features such as @TestSubject support for EasyMock, experimental support for Mockito 2 as well as bug fixes and other imporvements. See release notes and change log for details. We also want to give a warm welcome to our new core committer Arthur Zagretdinov.
  • 2015-12-11: PowerMock 1.6.4 has been released with better support for Jacoco and improvements to the DelegatingPowerMockRunner as well as some other minor fixes. See change log for details.

Older News

Documentation

Support and discussion

Join the mailing-list here for questions, feedback and support.

Links