Skip to content

test(eventhubs): modernize EventContextTest Mockito setup#48637

Open
j7nw4r wants to merge 1 commit into
mainfrom
fix/eventhubs-checkpoint-offset-46752
Open

test(eventhubs): modernize EventContextTest Mockito setup#48637
j7nw4r wants to merge 1 commit into
mainfrom
fix/eventhubs-checkpoint-offset-46752

Conversation

@j7nw4r
Copy link
Copy Markdown
Member

@j7nw4r j7nw4r commented Mar 30, 2026

Replaces deprecated MockitoAnnotations.initMocks(this) with openMocks(this) in EventContextTest, and closes the returned AutoCloseable in @AfterEach.

The original EventContext.updateCheckpointAsync() offsetString fix this branch started as has since landed on main via #49076, so this PR is now just the leftover Mockito API cleanup from review.

@j7nw4r j7nw4r force-pushed the fix/eventhubs-checkpoint-offset-46752 branch from a68fa9c to 1abecdb Compare March 30, 2026 20:06
@j7nw4r
Copy link
Copy Markdown
Member Author

j7nw4r commented May 6, 2026

/azp run java - pullrequest

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@j7nw4r j7nw4r marked this pull request as ready for review May 7, 2026 17:34
Copilot AI review requested due to automatic review settings May 7, 2026 17:34
@j7nw4r j7nw4r requested review from a team, axisc, hmlam and sjkwak as code owners May 7, 2026 17:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a regression where checkpoint offsets were not persisted because EventContext.updateCheckpointAsync() only populated the deprecated Checkpoint.offset (Long) while BlobCheckpointStore.updateCheckpoint() persisted Checkpoint.offsetString, resulting in null offset metadata in blob checkpoints.

Changes:

  • Propagates EventData.getOffsetString() into the Checkpoint created by EventContext.updateCheckpointAsync().
  • Updates BlobCheckpointStore.updateCheckpoint() to prefer offsetString and fall back to the deprecated offset (Long) when offsetString is missing.
  • Adds regression/unit tests and changelog entries for both the Event Hubs client and the blob checkpoint store.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/EventContext.java Populate Checkpoint.offsetString during checkpoint updates.
sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/EventContextTest.java New regression test asserting offsetString is set on checkpoint updates.
sdk/eventhubs/azure-messaging-eventhubs/CHANGELOG.md Documents the bug fix in the Event Hubs library.
sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/main/java/com/azure/messaging/eventhubs/checkpointstore/blob/BlobCheckpointStore.java Adds offsetString/offset fallback behavior and updates validation message.
sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/test/java/com/azure/messaging/eventhubs/checkpointstore/blob/BlobCheckpointStoreTests.java Adds tests covering fallback/preference behavior for offset metadata writing.
sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CHANGELOG.md Documents the bug fix in the blob checkpoint store library.

@j7nw4r j7nw4r force-pushed the fix/eventhubs-checkpoint-offset-46752 branch from 1dd9843 to 914779c Compare May 22, 2026 15:29
@j7nw4r
Copy link
Copy Markdown
Member Author

j7nw4r commented May 22, 2026

/azp run java - pullrequest

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@j7nw4r
Copy link
Copy Markdown
Member Author

j7nw4r commented May 22, 2026

/azp run java - pullrequest

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@j7nw4r j7nw4r force-pushed the fix/eventhubs-checkpoint-offset-46752 branch from 914779c to a8aa8be Compare May 22, 2026 18:32
Replace deprecated MockitoAnnotations.initMocks(this) with openMocks(this) and close the returned AutoCloseable in @AfterEach.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@j7nw4r j7nw4r force-pushed the fix/eventhubs-checkpoint-offset-46752 branch from a8aa8be to d7f07cb Compare May 22, 2026 18:54
@j7nw4r j7nw4r changed the title Fix missing offsetString in EventContext checkpoint update test(eventhubs): modernize EventContextTest Mockito setup May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants