Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Mocks are simulated objects that mimic the behavior of real objects in controlled ways. OpenMRS 1.9 finally includes Mockito which is a library designated for creating mocks dynamically. In this document we will present how to use them in the context of OpenMRS. The presented code works in OpenMRS 1.9.9+.

...

Jira Legacy
serverOpenMRS Issues
serverId45c5771b-fa4b-3e43-b34a-c19dc45ccc95
keyTRUNK-3586
 introduced ContextMockHelper which is deprecated, using powermock for mocking Context should also help.

...

It means that you called initMocks using static method import in your test. The fix is simply to use MociktoAnnotations.initMocks(this) instead of initMocks(this) or remove initMocks(this) and rely on BaseContextSensitiveTest calling it.