Skip to content

Increasing test coverage#1289

Draft
ORybak5 wants to merge 1 commit into
mainfrom
increase-test-coverage2
Draft

Increasing test coverage#1289
ORybak5 wants to merge 1 commit into
mainfrom
increase-test-coverage2

Conversation

@ORybak5

@ORybak5 ORybak5 commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

What

Increasing the adaptor's test coverage

Why

The more tests that cover different scenarios, the better, as they increase confidence in the adaptor and help maintain quality

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Internal change (non-breaking change with no effect on the functionality affecting end users)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • I have performed a self-review of my code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have updated the Changelog with details of my change in the UNRELEASED section if this change will affect end users
  • A corresponding change has been made to the Mapping Documentation repository

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

Looks good. No mutations were possible for these changes.
See https://pitest.org

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

Images built and published to ECR using a Build Id of PR-1147-7b3a583

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR increases unit test coverage in the common module by adding new JUnit 5 tests for core utility/services, improving confidence in JSON/FHIR parsing and logging-context handling.

Changes:

  • Add FhirParserTest covering parsing valid/invalid JSON into FHIR Parameters and encoding resources to JSON.
  • Add MDCServiceTest covering setting/getting and resetting the conversation ID stored in SLF4J MDC.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
common/src/test/java/uk/nhs/adaptors/common/util/fhir/FhirParserTest.java Adds unit tests for FHIR JSON parse/encode behavior and invalid JSON handling.
common/src/test/java/uk/nhs/adaptors/common/service/MDCServiceTest.java Adds unit tests for applying and clearing the MDC conversation ID.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +40 to +43
var encoded = fhirParser.encodeToJson(parameters);

assertTrue(encoded.contains("\"resourceType\": \"Parameters\""));
assertTrue(encoded.contains("\"name\": \"test-name\""));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants