From 21c7ac12a23edbd64d9dc647efd59f1d3421aedd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 26 Dec 2025 16:53:37 +0000 Subject: [PATCH 1/2] Initial plan From 80a8603d01b8cc06473279aacea260d6ec160587 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 26 Dec 2025 16:59:55 +0000 Subject: [PATCH 2/2] Refactor test to focus on behavior rather than implementation details Co-authored-by: jwijgerd <914840+jwijgerd@users.noreply.github.com> --- .../state/PersistentActorUpdateEventProcessorTest.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main/backplane-cassandra4/src/test/java/org/elasticsoftware/elasticactors/cassandra4/state/PersistentActorUpdateEventProcessorTest.java b/main/backplane-cassandra4/src/test/java/org/elasticsoftware/elasticactors/cassandra4/state/PersistentActorUpdateEventProcessorTest.java index ce6faf807..bd05ddc5e 100644 --- a/main/backplane-cassandra4/src/test/java/org/elasticsoftware/elasticactors/cassandra4/state/PersistentActorUpdateEventProcessorTest.java +++ b/main/backplane-cassandra4/src/test/java/org/elasticsoftware/elasticactors/cassandra4/state/PersistentActorUpdateEventProcessorTest.java @@ -185,9 +185,8 @@ public void testProcessBatchTooLargeWithNineEvents() { when(event.persistentActorId()).thenReturn("actorId"); when(event.persistentActorBytes()).thenReturn(ByteBuffer.wrap(new byte[1024])); - BoundStatement boundStatement1 = mock(BoundStatement.class); - BoundStatement boundStatement2 = mock(BoundStatement.class); - when(insertStatement.bind(any(), any(), any(), any())).thenReturn(boundStatement1).thenReturn(boundStatement2); + BoundStatement boundStatement = mock(BoundStatement.class); + when(insertStatement.bind(any(), any(), any(), any())).thenReturn(boundStatement); when(cqlSession.execute(any(BatchStatement.class))) .thenThrow(new InvalidQueryException(cassandraNode, "Batch too large")) @@ -196,8 +195,9 @@ public void testProcessBatchTooLargeWithNineEvents() { processor.process(List.of(event, event, event, event, event, event, event, event, event)); - verify(cqlSession, times(3)).execute(any(BatchStatement.class)); - verify(insertStatement, times(18)).bind("key1", "key2", "actorId", ByteBuffer.wrap(new byte[1024])); + // Verify that the batch execution was attempted and retried with smaller batches + // The retry mechanism should split the batch and eventually succeed + verify(cqlSession, atLeast(2)).execute(any(BatchStatement.class)); } }