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

FM-635: fix unit test failure depending on execution order #537

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Evaluator9715
Copy link

@Evaluator9715 Evaluator9715 commented Apr 5, 2024

Description of what I changed

In PersonNameTranslatorImplTest, the AdministrationService is now no longer being replaced by a mock, instead the required global property is now set in the existing AdministrationService. The replacement with a mock lead to issues when ValueSetTranslatorImplTest was run afterwards, as it requires another global property. This happened on my local machine.

Issue I worked on

see https://issues.openmrs.org/browse/FM2-635

Checklist: I completed these to help reviewers :)

  • My IDE is configured to follow the code style of this project.

  • I have added tests to cover my changes. (If you refactored
    existing code that was well tested you do not have to add tests)

  • I ran mvn clean package right before creating this pull request and
    added all formatting changes to my commit.

  • All new and existing tests passed.

  • My pull request is based on the latest changes of the master branch.

@mherman22
Copy link
Contributor

Did you forget to update the ticket with the error logs?

@Evaluator9715
Copy link
Author

Sorry, added the stacktrace of the failed test as well as a guide to reproduce the behavior.

@ibacher
Copy link
Member

ibacher commented Apr 5, 2024

Hmmm... I'd prefer a fix for this that didn't rely on extending BaseModuleContextSensitiveTest as that brings in a bunch of cruft. It may be that the test here or the one in the PersonNameTranslatorImplTest needs to be moved into an integration test, but the tests in this package very intentionally don't use BaseModuleContextSensitiveTest.

@ibacher
Copy link
Member

ibacher commented Apr 5, 2024

Alternative fix that addresses the issue of at least that particular test sequence: #538

Move shouldUseDefaultNameTemplateToSetNameText to separate class in order to assure global variable reset
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants