Java Mock Framework Supporting Actual Results and Static Methods

This question may have been asked before, but I have very specific things I'm looking for. I would like to integrate unit testing into an outdated web application, but for this, make sure that my unit tests are really repeatable and separate from the data access code. I need a good Mock Framework that supports the following conditions.

I would prefer to just use a single infrastructure that has all of the following functions, although if there is no such structure, it should be. My disappointment stems not from a lack of choice, but from too many, as it seems.

  • Mock Instance Methods
  • Mechanical static methods
  • The return value of the mock method
  • Fixed exception from mock
  • Order of mocking method calls (Nice to have)
  • Expected Results Compared to Actual Results (Nice to Have)

Does anyone have any suggestions for Java frameworks that meet these criteria?

+3
source share
1 answer

Try jmockit . In my opinion, it currently supports most of the features compared to others. This is also an active project, and you are likely to get very quick answers in your user group.

+1
source

All Articles