Whitebox.setInternalState for private static final fields
See original GitHub issueHello,
Can you please add the ability for Whitebox.setInternalState to be invokable on classes with private static final field?
Whitebox.setInternalState(ClassToTest.class, "LOG", mockLog);
I did not understand where is the best place to add a feature request. I hope this is the best place.
Thank you
Issue Analytics
- State:
- Created 7 years ago
- Comments:16 (3 by maintainers)
Top Results From Across the Web
PowerMock testing - set static field of class - Stack Overflow
Whitebox.setInternalState(Foo.class, b);. Works as long as you set a non-null value, and if theres only one field with the class of B ....
Read more >Whitebox.setInternalState doesn't work with final properties?
Hi, I need to assign a mock to a private static final field, and was under the impression that Whitebox.setInternalState would handle that....
Read more >Whitebox (powermock-reflect 1.6.3 API) - javadoc.io
setInternalState. public static void setInternalState(Object object, String fieldName, Object value). Set the value of a field using reflection. This method ...
Read more >org.powermock.reflect.Whitebox.setInternalState java code ...
Useful for testing classes with a private constructor. getType · getFields. Get an array of Field's that matches the supplied list of field...
Read more >whitebox.setinternalstate use
you are trying to set a private static final string. cannot set such fields! When accessing primitive static final fields, the Java compiler...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
So I can assume that we can close this
Hi! Why would you even want to do that? It sounds like a absolutely terrible idea to do that. Can you provide some use case?