Skip to content

Refactor batch retry tests to verify behavior instead of implementation details#165

Draft
Copilot wants to merge 3 commits intofeature/batch-too-large-retriesfrom
copilot/sub-pr-122-another-one
Draft

Refactor batch retry tests to verify behavior instead of implementation details#165
Copilot wants to merge 3 commits intofeature/batch-too-large-retriesfrom
copilot/sub-pr-122-another-one

Conversation

Copy link
Contributor

Copilot AI commented Dec 26, 2025

The batch retry tests in PersistentActorUpdateEventProcessorTest were verifying internal method call counts (e.g., insertStatement.bind() called exactly 6 times) rather than actual behavior. This makes tests brittle and prone to breaking when refactoring implementation while preserving functionality.

Changes

  • Removed bind() call count assertions from testProcessBatchTooLargeWithTwoEvents, testProcessBatchTooLargeWithThreeEvents, and testProcessBatchTooLargeWithNineEvents
  • Tests now verify batch retry mechanism triggers correctly and appropriate execute methods are called with expected statement types
  • Created distinct mock instances for each event instead of reusing a single mock, improving test isolation
  • Fixed variable shadowing where loop variable event shadowed class field

Before

verify(insertStatement, times(6)).bind("key1", "key2", "actorId", ByteBuffer.wrap(new byte[1024]));

After

verify(cqlSession, times(2)).execute(any(BatchStatement.class));
verify(cqlSession, times(1)).execute(any(BoundStatement.class));

Tests now assert on observable behavior (retry mechanism splits batch and processes events) rather than internal implementation details.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits December 26, 2025 17:01
Co-authored-by: jwijgerd <914840+jwijgerd@users.noreply.github.com>
Co-authored-by: jwijgerd <914840+jwijgerd@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for retries with smaller batch sizes Refactor batch retry tests to verify behavior instead of implementation details Dec 26, 2025
Copilot AI requested a review from jwijgerd December 26, 2025 17:06
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