Add dedicated unit tests for ReadonlyDataContextEnhancer#795
Merged
Schmarvinius merged 4 commits intomainfrom Apr 14, 2026
Merged
Add dedicated unit tests for ReadonlyDataContextEnhancer#795Schmarvinius merged 4 commits intomainfrom
Schmarvinius merged 4 commits intomainfrom
Conversation
Covers preserveReadonlyFields (draft/non-draft paths) and restoreReadonlyFields (with/without backup), using real CDS entities from RuntimeHelper instead of mocks. Refs: cap/cds-calesi#419
Contributor
There was a problem hiding this comment.
The new test class covers the main happy paths well and uses real CDS entities instead of mocks, which is commendable. However, there are three gaps worth addressing: the backup's exclusion of content should be explicitly asserted, the partial-backup/null-overwrite behavior in restoreReadonlyFields is untested, and the non-draft path with no pre-existing backup has no coverage.
PR Bot Information
Version: 1.20.11 | 📖 Documentation | 🚨 Create Incident | 💬 Feedback
- Correlation ID:
0f5a1820-3775-11f1-836a-cfdbc740c472 - LLM:
anthropic--claude-4.6-sonnet - File Content Strategy: Full file content
- Event Trigger:
pull_request.opened
lisajulia
approved these changes
Apr 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Dedicated Unit Tests for
ReadonlyDataContextEnhancerTest
🧪 Adds a new test class
ReadonlyDataContextEnhancerTestcovering thepreserveReadonlyFieldsandrestoreReadonlyFieldsmethods with 5 targeted unit tests. Tests use real CDS entities fromRuntimeHelperwith zero Mockito usage.Changes
ReadonlyDataContextEnhancerTest.java: New test class with 5 tests covering:preserveReadonlyFields_isDraft_backupCreated— verifies that a readonly backup (DRAFT_READONLY_CONTEXT) is created with the correct field values (contentId,status,scannedAt) when the draft flag istrue.preserveReadonlyFields_isNotDraft_backupRemoved— verifies that any existing readonly backup is removed when the draft flag isfalse.preserveReadonlyFields_isDraft_noAttachmentEntity_nothingHappens— confirms no backup is created for non-attachment entities.restoreReadonlyFields_withBackup_fieldsRestoredAndBackupRemoved— verifies that readonly fields are restored from the backup and the backup entry is subsequently removed.restoreReadonlyFields_withoutBackup_noOp— confirms no modifications occur when no backup exists.📬 Subscribe to the Hyperspace PR Bot DL to get the latest announcements and pilot features!
PR Bot Information
Version:
1.20.11| 📖 Documentation | 🚨 Create Incident | 💬 Feedbackissue_comment.edited295ad2d0-3777-11f1-9c0b-e94530c31a11