Skip to content

fix: ResultEntryRestControllerTest interpretation 500s (#4042) - #4123

Open
VedantMadane wants to merge 1 commit into
DIGI-UW:developfrom
VedantMadane:fix/4042-result-entry-interpretation-tests
Open

fix: ResultEntryRestControllerTest interpretation 500s (#4042)#4123
VedantMadane wants to merge 1 commit into
DIGI-UW:developfrom
VedantMadane:fix/4042-result-entry-interpretation-tests

Conversation

@VedantMadane

Copy link
Copy Markdown

Summary

Fixes the two ResultEntryRestControllerTest failures reported in #4042 (HTTP 500 on interpretation saves).

Root causes

  1. Duplicate interpretation notesnote is not part of result.xml, so interpretation rows accumulate across test methods and NoteServiceImpl.insert throws LIMSDuplicateRecordException (500). Re-saving the same interpretation text in production hit the same path.
  2. FHIR mock NPE – test FhirContext is a bare Mockito mock, so newJsonParser() returns null and encode NPEs during result-save FHIR sync (logged as store unavailable).

Changes

  • FhirPersistanceServiceImpl: null-safe encodeResourceSafe for trace logs; availability guard before local FHIR transactions (throws checked FhirLocalPersistingException, already swallowed by result-entry callers).
  • ResultUtil: skip adding an interpretation note when duplicateNoteExists (same pattern as corrected-result notes).
  • ResultEntryRestControllerTest: delete leftover clinlims.note rows for the fixture analyses in @Before.

Test plan

  • mvn test -Dtest=ResultEntryRestControllerTest
  • Confirm save_withInterpretation_writesReportVisibleNote and save_interpretationFromComponentRow_isScopedToThatComponent return 200

Closes #4042

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

Two ResultEntryRestControllerTest failures on develop (pre-existing, not introduced by OGC-1142)

1 participant