...
If you use the Maven archetype to create your module, see this. If you are using an older mavenized or unmavenized module, see this.
...
The two dependencies should be placed in the modue (api/omod) pom files for openmrs platform 1.11.x, may not need to update the parent pom file
Create Your Test
Code Block |
---|
package org.openmrs.module.yourmodule; /** * Tests the MyModuleService class and all of its methods * **/ public class MyModuleServiceTest extends BaseModuleContextSensitiveTest { /** * Make sure that MyService runs fine with a null * parameter to getMyModuleObject * * @throws Exception */ @Test public void shouldGetMyModuleObjectWithNullParameter() throws Exception { MyModuleService service = Context.getService(MyModuleService.class)); MyModuleObject obj = service.getMyModuleByName(null); Assert.assertNull(output); } } |
...
(When running unit tests in Eclipse) Make sure that you are using Spring 2.5 or above. You can also addsetDependencyCheck(false) to the constructor of your test class.