Add tests to MessageServiceImpl

Hello all i have been working on this ticket In order to use the massage objects to write Unit tests on the overloaded sendMessage (…) methods, I think we should change the highlighted methods from returning void to returning a object because I neither see a table that store sent messages. Thanks…@dkayiwa, @k.joseph, @teleivo

Hi @jwnasambu,

you should be able to write tests without changing the API of MessageService. You could use mocks as in ProgramWorkflowServiceUnitTest which allow you to check if a service has been called and assert the arguments it got passed to.


@teleivo thanks

You can throw an APIException and store the message code in it. It’s the standard way in OpenMRS IIRC.

1 Like