# Java Testing Notes

## Java Testing

- [Java Testing](https://notes.tejpratapsingh.com/java-testing/java-testing.md)
- [Mockito](https://notes.tejpratapsingh.com/java-testing/mockito.md): Mocking framework for unit tests in Java
- [Mockito.mock()](https://notes.tejpratapsingh.com/java-testing/mockito/mockito.mock.md): Creates a mock of any non final class
- [Mockito.spy()](https://notes.tejpratapsingh.com/java-testing/mockito/mockito.spy.md)
- [Mockito.verify()](https://notes.tejpratapsingh.com/java-testing/mockito/mockito.verify.md): Verify interactions with your mock
- [Mockito.mockStatic()](https://notes.tejpratapsingh.com/java-testing/mockito/mockito.mockstatic.md): Mock static methods without PowerMock
- [ArgumentMatcher](https://notes.tejpratapsingh.com/java-testing/mockito/argumentmatcher.md): Match arguments passed in a method of your mock
- [ArgumentCaptor](https://notes.tejpratapsingh.com/java-testing/mockito/argumentcaptor.md): Can do everything argument matcher can and still more
- [PowerMockito](https://notes.tejpratapsingh.com/java-testing/powermockito.md)
- [Why we need PowerMock?](https://notes.tejpratapsingh.com/java-testing/powermockito/why-we-need-powermock.md)
- [PowerMockRunner](https://notes.tejpratapsingh.com/java-testing/powermockito/powermockrunner.md): You must annotate each class you test with PowerMockRunner
- [PrepareForTest](https://notes.tejpratapsingh.com/java-testing/powermockito/preparefortest.md): Mark this class for bytecode manipulation
- [Understanding @PrepareForTest](https://notes.tejpratapsingh.com/java-testing/powermockito/preparefortest/understanding-preparefortest.md): PrepareForTest is very powerful tool that unlocks class manipulation capabilities by modifying class to byte code level.
- [SuppressStaticInitializationFor](https://notes.tejpratapsingh.com/java-testing/powermockito/suppressstaticinitializationfor.md)
- [PowerMockito.suppress()](https://notes.tejpratapsingh.com/java-testing/powermockito/powermockito.suppress.md)
- [PowerMockito.stub()](https://notes.tejpratapsingh.com/java-testing/powermockito/powermockito.stub.md)
- [PowerMockito.replace()](https://notes.tejpratapsingh.com/java-testing/powermockito/powermockito.replace.md)
- [PowerMockito.whenNew()](https://notes.tejpratapsingh.com/java-testing/powermockito/powermockito.whennew.md)
- [Limitation of PowerMockito.whenNew()](https://notes.tejpratapsingh.com/java-testing/powermockito/powermockito.whennew/limitation-of-powermockito.whennew.md): Why Powermockito.whenNew() is not enough.
- [Whitebox.invokeMethod()](https://notes.tejpratapsingh.com/java-testing/powermockito/whitebox.invokemethod.md)
- [Whitebox.setInternalState()](https://notes.tejpratapsingh.com/java-testing/powermockito/whitebox.setinternalstate.md)
- [Whitebox.getInternalState()](https://notes.tejpratapsingh.com/java-testing/powermockito/whitebox.getinternalstate.md)
- [Tips](https://notes.tejpratapsingh.com/java-testing/tips.md): Pages with tips to test your code effectively
- [How to test ViewModel and LiveData](https://notes.tejpratapsingh.com/java-testing/tips/how-to-test-viewmodel-and-livedata.md): Test your async code build on top of androidx arch.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information, you can query the documentation dynamically by asking a question.
Perform an HTTP GET request on a page URL with the `ask` query parameter:
```
GET https://notes.tejpratapsingh.com/java-testing/java-testing.md?ask=<question>
```
The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.
Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
