Skip to content

UnitTest für IrsBatchResponse.java#1470

Closed
ds-vlisenco wants to merge 1 commit intoeclipse-tractusx:mainfrom
ds-vlisenco:IrsBatchResponse
Closed

UnitTest für IrsBatchResponse.java#1470
ds-vlisenco wants to merge 1 commit intoeclipse-tractusx:mainfrom
ds-vlisenco:IrsBatchResponse

Conversation

@ds-vlisenco
Copy link
Copy Markdown

@ds-vlisenco ds-vlisenco commented Jun 2, 2025

will be hidden from the rendered preview of your PR.

-->

Title

test: add unit tests for IrsBatchResponse and nested JobRecord class

Description

This PR introduces unit tests for the IrsBatchResponse class and its nested static class JobRecord.

Summary of changes:

  • Added test for standard constructor and accessors
  • Tested behavior with null values
  • Tested behavior with an empty jobs list
  • Validated accessors for JobRecord

The edge case in my test suite is:
@test
void testWithNullValues() {
IrsBatchResponse.JobRecord job = new IrsBatchResponse.JobRecord(null, null, null, null);
IrsBatchResponse response = new IrsBatchResponse(
null,
0,
null,
0,
null,
null,
0,
null,
null,
0
);

assertNull(job.completedOn());
assertNull(job.id());
assertNull(job.startedOn());
assertNull(job.state());

assertNull(response.batchId());
assertEquals(0, response.batchNumber());
assertNull(response.batchProcessingState());
assertEquals(0, response.batchTotal());
assertNull(response.completedOn());
assertNull(response.jobs());
assertEquals(0, response.jobsInBatchChecksum());
assertNull(response.orderId());
assertNull(response.startedOn());
assertEquals(0, response.totalJobs());

}

Why this is an edge case:
This test checks how the system behaves when all optional or nullable fields are set to null or their default values (like 0 for integers). Such scenarios often occur when data is incomplete, deserialized from external sources, or corrupted. These are edge cases because they test the boundaries of valid input, ensuring that the application doesn't crash or behave unexpectedly when handling minimal or missing data.
It helps verify the system's null-safety and resilience, which is crucial for robust production systems.

These tests improve code coverage and ensure that the data structures behave as expected under typical and edge-case conditions.

No related issue.

Pre-review checks

Please ensure to do as many of the following checks as possible before asking for committer review:

  • DEPENDENCIES are up-to-date. Dash license tool
  • Copyright and license header
  • Tests added and passing
  • Code formatting and structure checked

@ds-vlisenco ds-vlisenco deleted the IrsBatchResponse branch June 25, 2025 11:14
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