Package org.mockito
Interface MockedStatic<T>
-
- Type Parameters:
T
- The type being mocked.
- All Superinterfaces:
AutoCloseable
,ScopedMock
public interface MockedStatic<T> extends ScopedMock
Represents an active mock of a type's static methods. The mocking only affects the thread on which this static mock was created and it is not safe to use this object from another thread. The static mock is released when this object'sScopedMock.close()
method is invoked. If this object is never closed, the static mock will remain active on the initiating thread. It is therefore recommended to create this object within a try-with-resources statement unless when managed explicitly, for example by using a JUnit rule or extension.If the
Mock
annotation is used on fields or method parameters of this type, a static mock is created instead of a regular mock. The static mock is activated and released upon completing any relevant test.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
MockedStatic.Verification
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
clearInvocations()
void
reset()
default void
verify(MockedStatic.Verification verification)
void
verify(MockedStatic.Verification verification, VerificationMode mode)
void
verifyNoInteractions()
void
verifyNoMoreInteractions()
<S> OngoingStubbing<S>
when(MockedStatic.Verification verification)
SeeMockito.when(Object)
.-
Methods inherited from interface org.mockito.ScopedMock
close, closeOnDemand, isClosed
-
-
-
-
Method Detail
-
when
<S> OngoingStubbing<S> when(MockedStatic.Verification verification)
SeeMockito.when(Object)
.
-
verify
default void verify(MockedStatic.Verification verification)
-
verify
void verify(MockedStatic.Verification verification, VerificationMode mode)
-
reset
void reset()
-
clearInvocations
void clearInvocations()
-
verifyNoMoreInteractions
void verifyNoMoreInteractions()
-
verifyNoInteractions
void verifyNoInteractions()
-
-