> For the complete documentation index, see [llms.txt](https://notes.tejpratapsingh.com/java-testing/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://notes.tejpratapsingh.com/java-testing/powermockito/whitebox.setinternalstate.md).

# Whitebox.setInternalState()

PowerMockito allows you to inject value to globally declared member fields, this is also a wrapper around Java Reflection API's.

```java
Whitebox.setInternalState(classUnderTest, "mCustomClassObject", (CustomClass) null);
```

**Note:** You should not set values left and wright with `setInternalState()` method, this should only be used when there is some if condition that is always `true` and you need to test else condition. for example, a null check when that object cannot be null at that time.
