mockspresso-mockito-powermock / com.episode6.hackit.mockspresso.mockito.powermock / PowerMockitoFieldPreparer

PowerMockitoFieldPreparer

open class PowerMockitoFieldPreparer : FieldPreparer

A FieldPreparer for Powermock + Mockito. Powermock doesn't seem to offer a nice way to init mocks on an arbitrary object that isn't the testClass (and the runner/rule deals with those). So to handle testResources, we use this custom FieldPreparer that expects some mocks/spies to already be initialized (and doesn't touch those). We use PowerMockito#mock(Class) to create mocks and Mockito#spy(Object)/Mockito#spy(Class) to create spies.

Constructors

<init>

PowerMockitoFieldPreparer()

A FieldPreparer for Powermock + Mockito. Powermock doesn't seem to offer a nice way to init mocks on an arbitrary object that isn't the testClass (and the runner/rule deals with those). So to handle testResources, we use this custom FieldPreparer that expects some mocks/spies to already be initialized (and doesn't touch those). We use PowerMockito#mock(Class) to create mocks and Mockito#spy(Object)/Mockito#spy(Class) to create spies.

Functions

prepareFields

open fun prepareFields(objectWithMockFields: Any): Unit