Mockito Concepts: Difference between revisions
Jump to navigation
Jump to search
Line 21: | Line 21: | ||
[[PowerMock]] can mock these constructs. | [[PowerMock]] can mock these constructs. | ||
=Managed Test Double= | =Managed Test Double= | ||
A [[Software Testing Concepts#Test_Double|test double]] managed by Mockito. It can be created either via the API with <code>[[#Mockito.mock.28.29|Mockito.mock(<object>)]]</code> or by annotating the field referencing the object in question with [[#@Mock|Mock]]. | A [[Software Testing Concepts#Test_Double|test double]] managed by Mockito. It can be created either via the API with <code>[[#Mockito.mock.28.29|Mockito.mock(<object>)]]</code> or by annotating the field referencing the object in question with [[#@Mock|@Mock]]. |
Revision as of 04:27, 16 July 2021
Internal
Overview
MockitoJUnitRunner
Mockito.mock()
@Mock
Can't Mock
- Final classes
- Final methods
- Enums
- Static methods
- Private methods
hashCode()
andequals()
methods- Anonymous classes
- Primitive types
PowerMock can mock these constructs.
Managed Test Double
A test double managed by Mockito. It can be created either via the API with Mockito.mock(<object>)
or by annotating the field referencing the object in question with @Mock.