Skip to content

test: enhance ExternalResourcesTest coverage with additional cases#3647

Open
lmj798 wants to merge 2 commits intomybatis:masterfrom
lmj798:master
Open

test: enhance ExternalResourcesTest coverage with additional cases#3647
lmj798 wants to merge 2 commits intomybatis:masterfrom
lmj798:master

Conversation

@lmj798
Copy link

@lmj798 lmj798 commented Mar 5, 2026

Summary

Add 7 new test cases for ExternalResources.copyExternalResource() to enhance test coverage.
Add tests for file content correctness, destination overwrite, empty file copying, binary content, null source validation, 4096-byte boundary size, and non-existent directory path validation.
Update copyright year to 2026 in test file.

Why

Existing tests cover basic copy operations, file not found scenarios, and empty string paths, but lack explicit coverage for edge cases like empty files, binary content, and boundary conditions (e.g., 4096 bytes).
These boundary cases are prone to regression (for example, through buffer handling or I/O stream changes), so explicit tests improve behavioral stability and ensure robustness across different file types and sizes.

Verification

Ran mvn -Dtest=ExternalResourcesTest test
Result: all 11 tests passed

lmj798 added 2 commits March 5, 2026 10:37
- Add shouldCopyFileContentCorrectly() - verify file content copying
- Add shouldOverwriteExistingDestination() - verify destination overwrite
- Add shouldCopyEmptyFile() - verify empty file copying
- Add shouldCopyFileWithBinaryContent() - verify binary content copying
- Add shouldThrowExceptionWhenSourceIsNull() - verify null source exception
- Add shouldCopyFileWithSizeExactly4096Bytes() - verify 4096-byte boundary
- Add shouldThrowExceptionWhenDestPathContainsNonExistentDirectory() - verify path validation
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