Skip to content

Test:sample type test assign service integration test - #4148

Open
Agaba-derrick wants to merge 4 commits into
DIGI-UW:developfrom
Agaba-derrick:fix/sample-type-test-assign-service-integration-test
Open

Test:sample type test assign service integration test#4148
Agaba-derrick wants to merge 4 commits into
DIGI-UW:developfrom
Agaba-derrick:fix/sample-type-test-assign-service-integration-test

Conversation

@Agaba-derrick

Copy link
Copy Markdown
Contributor

Pull Requests Requirements

  • The PR title includes a brief description of the work done, including the
    Issue number if applicable.
  • The PR includes a video showing the changes for the work done.
  • The PR title follows conventional commit label standards.
  • The changes confirm to the OpenElis Global x3
    Styleguide and Design
    documentation.
  • The changes include tests or are validated by existing tests.
  • I have read and agree to the Contributing
    Guidelines of this
    project.

Summary

Add Integration Tests for SampleTypeTestAssignService

What

Adds the first integration test for SampleTypeTestAssignServiceImpl — a previously untested service in the testconfiguration module responsible for managing the administrative linkage between Tests and Sample Types.

Why

SampleTypeTestAssignService.update() orchestrates several coordinated write operations (delete existing TypeOfSampleTest rows, update TypeOfSample, insert a new TypeOfSampleTest, optionally deactivate another sample type) with no existing test coverage. A failure in any branch of this logic silently corrupts test configuration.

Changes

New file: src/test/java/org/openelisglobal/testconfiguration/service/SampleTypeTestAssignServiceIntegrationTest.java

Three test cases covering the key behavioral branches of update():

Test Branch covered
update_ShouldDeleteExistingAndCreateNew_WhenFlagsAreTrue Deletes old TypeOfSampleTest links, creates a new one, persists field changes on TypeOfSample
update_ShouldDeactivateSampleType_WhenProvided Deactivates a secondary TypeOfSample while still creating the new assignment link
update_ShouldOnlyCreateNewLink_WhenFlagsAreFalse Creates a new link only; does not modify the sample type when update flags are false

Screenshots

Related Issue

Issue #3803

Other

Tests cover the three main behavioral paths of SampleTypeTestAssignService.update():
- Full update path: deletes existing TypeOfSampleTest links, creates a new
  link, and persists sample type field updates.
- Deactivation path: deactivates a secondary TypeOfSample while still
  creating the new test assignment link.
- Assignment-only path: creates a new link without modifying the sample type
  when both update flags are false.

Uses BaseWebContextSensitiveTest + DBUnit (testdata/sample-type-test.xml)
following the project's backend integration testing AI skill pattern.
Signed-off-by: Agaba-derrick <agabaderrick18@gmail.com>
@Agaba-derrick Agaba-derrick changed the title Fix/sample type test assign service integration test Test:sample type test assign service integration test Aug 29, 2026
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.

1 participant