Skip to content

Refactor SdsClient and SdsRequestBuilder for correct encapsulation of configuration property - #358

Open
MartinWheelerMT wants to merge 2 commits into
mainfrom
refactor-gpc-consumer
Open

MartinWheelerMT wants to merge 2 commits into
mainfrom
refactor-gpc-consumer

Conversation

@MartinWheelerMT

@MartinWheelerMT MartinWheelerMT commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator

What

  • Remove unused method in SdsClientTest.
  • Moved configuration property supplierOdsCode which is read from environment variables from SdsClient to SdsRequestBuilder
  • Refactored SdsRequestBuilder to directly use the injected configuration supplierOdsCode removing and replacing in methods where appropriate.
  • Removed buildAsidClientFor as it is now just a wrapper for buildAsDeviceAsidRequest, which in itself has now been renamed to buildAsidClientFor to match existing code call.
  • Removed tests associated with removed the code for checking if the supplierOdsCode is empty. This is due to the fact that validation has subsequently been enabled so that the adaptor will not start if the supplierOdsCode is not provided or is an empty / whitespace only string.
  • Added new test to SSdsConfigurationValidationTest to test with a whitespace only value for supplierOdsCode.

Why

Application configuration validation already takes place, preventing startup on errors. Due to this we can correctly inject supplierOdsCode where it is actually used. There is no longer a required to check if the value is null or whitespace within the method due to this validation. Due to this we have updated several tests and passed the reflection value update to SdsRequestBuilder rather than SdsClient.

An extra test has been introduced to confirm this works as expected, and several now unneeded tests have been removed.

Type of Change

Please check the option(s) that apply.

  • Internal change (non-breaking change with no effect on functionality affecting end users)

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

* Remove unused method in `SdsClientTest`.
* Moved configuration property `supplierOdsCode` which is read from environment variables from `SdsClient` to `SdsRequestBuilder`
* Refactored `SdsRequestBuilder` to directly use the injected configuration `supplierOdsCode` removing and replacing in methods where appropriate.
* Removed `buildAsidClientFor` as it is now just a wrapper for `buildAsDeviceAsidRequest`, which in itself has now been renamed to `buildAsidClientFor` to match existing code call.
* Removed tests associated with removed the code for checking if the `supplierOdsCode` is empty.  This is due to the fact that validation has subsequently been enabled so that the adaptor will not start if the `supplierOdsCode` is not provided or is an empty / whitespace only string.
* Added new test to `SSdsConfigurationValidationTest` to test with a whitespace only value for `supplierOdsCode`.
@MartinWheelerMT
MartinWheelerMT requested a review from a team as a code owner September 15, 2026 13:47
@MartinWheelerMT
MartinWheelerMT enabled auto-merge (squash) September 15, 2026 13:48
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.

1 participant