Have you implemented OpenMRS? Please participate in the Implementation Site Survey. If you already have, thank you!
Page tree

Versions Compared

Key

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

...

  • type in the name of the template (which you can find in the Templates settings as shown above)
  • hit Control+Space (for the Eclipse context menu)
  • select the template and hit Enter
  • if there are variables in the template you can now override them and advance to the next variable or the end with TAB

to speed up coding and adhere to the OpenMRS style more easily.

Read the next sections for some examples.

...

To add a new unit test to a test class, open the test class in the editor. Place the cursor to where you want to add the test and write test and hit Control+Space (for the context menu) which will show you a list of options like shown below

Image Modified

select the "OpenMRS Style JUnit 4 Test" and hit enter to get this

...

the words you see selected are variables/placeholders, with the darker one being on focus. Enter the method name you want to test and hit TAB to advance to the next variable and type in the should style sentence of what you are testing. Hit TAB again to advance to the method body.

...

If you want to log an event in a class that does not yet have an instance of a Logger open the class and place the cursor to the top and type logger and hit Control+Space (for the context menu) which will show you a list of options like shown below

...

If your class already has a Logger instance just place the cursor to where you want to log and type logd (for debug), logi (for info), ... hit Control+Space (for the context menu) select the template and hit enter. Depending on what template you are using you might need to only enter your log message or also add a parameter after the message like for example for loge logpe (for logging errors).an error and passing it an exception) or logpi (to log an info message using the slf4j parametrized message style like log.info("the temperatur was {}", temperatureObject) ).

Maven Settings

Open pom.xml as xml instead of in GUI

...