What are you looking for is called partial mocking.
In PowerMock you can use mockStaticPartial method.
In PowerMockito you can use stubbing, which will stub only the method defined and leave other unchanged:
also don’t forget about the
- Using PowerMockito.whenNew() is not getting mocked and original method is called
- Mock a constructor with parameter
- How to mock private method for testing using PowerMock?
- Mocking Logger and LoggerFactory with PowerMock and Mockito
- How to mock static method without powermock
- How to verify that a specific method was not called using Mockito?
- Mockito: Trying to spy on method is calling the original method
- Mockito : how to verify method was called on an object created within a method?
- How to capture a list of specific type with mockito
- How to mock a final class with mockito
- Mockito. Verify method arguments
- How to tell a Mockito mock object to return something different the next time it is called?
- Difference between @Mock, @MockBean and Mockito.mock()
- When to use Mockito.verify()?
- Example of Mockito’s argumentCaptor
- Mockito + PowerMock LinkageError while mocking system class
- Java verify void method calls n times with Mockito
- How to resolve Unneccessary Stubbing exception
- Mockito How to mock and assert a thrown exception?
- How to use ArgumentCaptor for stubbing?
- Mockito – NullpointerException when stubbing Method
- Testing Private method using mockito
- mock instance is null after @Mock annotation
- PowerMockito mock single static method and return object
- Test class with a new() call in it with Mockito
- Mockito verify after exception Junit 4.10
- What is the difference between Mockito.mock(SomeClass) and the @Mock annotation?
- Modify input parameter of a void function and read it afterwards
- Mockito – how to verify that a mock was never invoked
- Can I delay a stubbed method response with Mockito?
- How to write a matcher that is not equal to something
- mock nested method calls using mockito
- reason: no instance(s) of type variable(s) T exist so that void conforms to using mockito
- How to test a component / bean in Spring Boot
- How to use @InjectMocks along with @Autowired annotation in Junit
- PowerMock + Mockito VS Mockito alone
- Using Mockito to stub and execute methods for testing
- How do I mock a REST template exchange?
- Mock private static final field using mockito or Jmockit
- Do Mock objects get reset for each test?
- Unable to run JUnit test with PowerMockRunner
- How to mock new Date() in java using Mockito
- Mocking a singleton with mockito
- Mock same method with different parameters
- Forming Mockito “grammars”
- Junit Parameterized tests together with Powermock – how?
- Can’t return Class Object with Mockito
- How to test Spring @Scheduled
- Resource files not found from JUnit test cases
- Unit testing with mockito for constructors