Home » Core Java » PowerMockito

PowerMockito

PowerMock Mock Static Method Example

In the Mockito Tutorial for Beginners, we did a general introduction to the Mockito mocking framework for JUnit tests. One the things that we did not see, was the mocking of static methods. That is because Mockito doesn’t allow to do that. To solve this, we will use PowerMock, a framework that extends Mockito’s functionalities (and other mocking frameworks’ also), ...

Read More »

PowerMockito Tutorial for Beginners

A unit test should test a class in isolation. Side effects from other classes or the system should be eliminated if possible. Mockito lets you write beautiful tests with a clean & simple API. In this example we will learn about PowerMockito which is an extension of Mockito. PowerMockito extends Mockito functionality with several new features such as mocking static ...

Read More »

PowerMockito Constructor Example

A unit test should test a class in isolation. Side effects from other classes or the system should be eliminated if possible. Mockito lets you write beautiful tests with a clean & simple API. In this example we will learn how to mock constructor using PowerMock. PowerMockito extends Mockito functionality with several new features such as mocking static and private ...

Read More »

PowerMockito Spy Example

A unit test should test a class in isolation. Side effects from other classes or the system should be eliminated if possible. Mockito lets you write beautiful tests with a clean & simple API. In this example we will learn how to mock a private method. PowerMockito extends Mockito functionality with several new features such as mocking static and private ...

Read More »