fix: ResultEntryRestControllerTest interpretation 500s (#4042) - #4123
Open
VedantMadane wants to merge 1 commit into
Open
fix: ResultEntryRestControllerTest interpretation 500s (#4042)#4123VedantMadane wants to merge 1 commit into
VedantMadane wants to merge 1 commit into
Conversation
Guard FHIR JSON encoding when FhirContext/parser is unavailable in tests, skip duplicate interpretation notes on re-save, and clear leftover note rows between ResultEntryRestControllerTest methods (note is outside the result.xml fixture truncate set). Signed-off-by: Vedant Madane <6527493+VedantMadane@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the two
ResultEntryRestControllerTestfailures reported in #4042 (HTTP 500 on interpretation saves).Root causes
noteis not part ofresult.xml, so interpretation rows accumulate across test methods andNoteServiceImpl.insertthrowsLIMSDuplicateRecordException(500). Re-saving the same interpretation text in production hit the same path.FhirContextis a bare Mockito mock, sonewJsonParser()returns null and encode NPEs during result-save FHIR sync (logged as store unavailable).Changes
FhirPersistanceServiceImpl: null-safeencodeResourceSafefor trace logs; availability guard before local FHIR transactions (throws checkedFhirLocalPersistingException, already swallowed by result-entry callers).ResultUtil: skip adding an interpretation note whenduplicateNoteExists(same pattern as corrected-result notes).ResultEntryRestControllerTest: delete leftoverclinlims.noterows for the fixture analyses in@Before.Test plan
mvn test -Dtest=ResultEntryRestControllerTestsave_withInterpretation_writesReportVisibleNoteandsave_interpretationFromComponentRow_isScopedToThatComponentreturn 200Closes #4042