How to mock final field? mockito/powermock
junit, mockito, powermock, testing, unit-testing
Solution
You can use a framework that allows for mocking calls to constructors such as JMockit or Powermock.
Powermock
JMockit
Problem
I have same class ``` class MyCalss{ final static SomeClass field = new SomeClass(); ... } ``` I should to mock instance of MyCalss. This mock should contain field like real object. How can I achieve it?