T
- The type being mocked.@Incubating public interface MockedStatic<T> extends AutoCloseable
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.
Modifier and Type | Interface and Description |
---|---|
static interface |
MockedStatic.Verification |
Modifier and Type | Method and Description |
---|---|
void |
clearInvocations()
|
void |
close() |
void |
closeOnDemand()
Releases this static mock and is non-operational if already released.
|
void |
reset()
|
default void |
verify(MockedStatic.Verification verification)
|
void |
verify(VerificationMode mode,
MockedStatic.Verification verification)
|
void |
verifyNoInteractions()
|
void |
verifyNoMoreInteractions()
|
<S> OngoingStubbing<S> |
when(MockedStatic.Verification verification)
See
Mockito.when(Object) . |
<S> OngoingStubbing<S> when(MockedStatic.Verification verification)
Mockito.when(Object)
.default void verify(MockedStatic.Verification verification)
void verify(VerificationMode mode, MockedStatic.Verification verification)
void reset()
void clearInvocations()
void verifyNoMoreInteractions()
void verifyNoInteractions()
void close()
close
in interface AutoCloseable
void closeOnDemand()