Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TRUNK-5388 Make ModuleFileParser MessageSourceService dependency explicit #2655

Merged
merged 3 commits into from
Apr 14, 2018

Conversation

teleivo
Copy link
Member

@teleivo teleivo commented Apr 12, 2018

@coveralls
Copy link

coveralls commented Apr 12, 2018

Coverage Status

Coverage decreased (-0.003%) to 58.963% when pulling 81b0aa1 on teleivo:TRUNK-5388 into 4b7461d on openmrs:master.

…icit

new
* add constructor ModuleFileParser(MessageSourceService) to clearly
state dependencies, which enables easier testing by passing in a mock or
use of a different implementation of a MessageSourceService
* add method ModuleFileParser.parse(File)
* add method ModuleFileparser.parse(InputStream)
which provide the same functionality/use the same implementation
underneath

deprecate
* deprecate all other constructors (3 in total)
* deprecate parse() in favor of parse(File), there is no need to keep
the file as state. This way we can create one parser and reuse it by
just passing in a different file to parse

tests
* move all tests which do not need the Context to be there to the
ModuleFileParserUnitTest which is now BaseContextMockTest and uses mocks
of the MessageSourceService
* one test still needs to stay in the BaseContextSensitive test since
the Context.getLocale() is still called. Did not add Locale as
dependency since I think this specific method getMessage(String key,
Object[] args) should be implementated in the MessageSourceService
as is getMessage(String) which abstracts away the users current locale
for us
with ModuleFileParser(MessageSourceService)

* in ModuleFactory
* in ModuleExtensionsTest
@teleivo teleivo merged commit 57d54fb into openmrs:master Apr 14, 2018
@teleivo teleivo deleted the TRUNK-5388 branch April 14, 2018 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants