clolov commented on code in PR #14716: URL: https://github.com/apache/kafka/pull/14716#discussion_r1553223975
########## streams/src/test/java/org/apache/kafka/streams/processor/internals/StreamTaskTest.java: ########## @@ -309,49 +300,49 @@ public void shouldThrowLockExceptionIfFailedToLockStateDirectory() throws IOExce @Test public void shouldNotAttemptToLockIfNoStores() { - stateDirectory = EasyMock.createNiceMock(StateDirectory.class); - EasyMock.replay(stateDirectory); + stateDirectory = mock(StateDirectory.class); task = createStatelessTask(createConfig("100")); task.initializeIfNeeded(); // should fail if lock is called - EasyMock.verify(stateDirectory); + verify(stateDirectory, never()).lock(any()); } @Test public void shouldAttemptToDeleteStateDirectoryWhenCloseDirtyAndEosEnabled() throws IOException { - final IMocksControl ctrl = EasyMock.createStrictControl(); - final ProcessorStateManager stateManager = ctrl.createMock(ProcessorStateManager.class); - EasyMock.expect(stateManager.taskType()).andStubReturn(TaskType.ACTIVE); - stateDirectory = ctrl.createMock(StateDirectory.class); + final ProcessorStateManager stateManager = mock(ProcessorStateManager.class); + when(stateManager.taskType()).thenReturn(TaskType.ACTIVE); + stateDirectory = mock(StateDirectory.class); - stateManager.registerGlobalStateStores(emptyList()); - EasyMock.expectLastCall(); + doNothing().when(stateManager).registerGlobalStateStores(emptyList()); Review Comment: No, it is already verified later on, removed ########## streams/src/test/java/org/apache/kafka/streams/processor/internals/StreamTaskTest.java: ########## @@ -309,49 +300,49 @@ public void shouldThrowLockExceptionIfFailedToLockStateDirectory() throws IOExce @Test public void shouldNotAttemptToLockIfNoStores() { - stateDirectory = EasyMock.createNiceMock(StateDirectory.class); - EasyMock.replay(stateDirectory); + stateDirectory = mock(StateDirectory.class); task = createStatelessTask(createConfig("100")); task.initializeIfNeeded(); // should fail if lock is called - EasyMock.verify(stateDirectory); + verify(stateDirectory, never()).lock(any()); } @Test public void shouldAttemptToDeleteStateDirectoryWhenCloseDirtyAndEosEnabled() throws IOException { - final IMocksControl ctrl = EasyMock.createStrictControl(); - final ProcessorStateManager stateManager = ctrl.createMock(ProcessorStateManager.class); - EasyMock.expect(stateManager.taskType()).andStubReturn(TaskType.ACTIVE); - stateDirectory = ctrl.createMock(StateDirectory.class); + final ProcessorStateManager stateManager = mock(ProcessorStateManager.class); + when(stateManager.taskType()).thenReturn(TaskType.ACTIVE); + stateDirectory = mock(StateDirectory.class); - stateManager.registerGlobalStateStores(emptyList()); - EasyMock.expectLastCall(); + doNothing().when(stateManager).registerGlobalStateStores(emptyList()); - EasyMock.expect(stateManager.taskId()).andReturn(taskId); + when(stateManager.taskId()).thenReturn(taskId); Review Comment: Nope, I do not, it is already in the setup! ########## streams/src/test/java/org/apache/kafka/streams/processor/internals/StreamTaskTest.java: ########## @@ -309,49 +300,49 @@ public void shouldThrowLockExceptionIfFailedToLockStateDirectory() throws IOExce @Test public void shouldNotAttemptToLockIfNoStores() { - stateDirectory = EasyMock.createNiceMock(StateDirectory.class); - EasyMock.replay(stateDirectory); + stateDirectory = mock(StateDirectory.class); task = createStatelessTask(createConfig("100")); task.initializeIfNeeded(); // should fail if lock is called - EasyMock.verify(stateDirectory); + verify(stateDirectory, never()).lock(any()); } @Test public void shouldAttemptToDeleteStateDirectoryWhenCloseDirtyAndEosEnabled() throws IOException { - final IMocksControl ctrl = EasyMock.createStrictControl(); - final ProcessorStateManager stateManager = ctrl.createMock(ProcessorStateManager.class); - EasyMock.expect(stateManager.taskType()).andStubReturn(TaskType.ACTIVE); - stateDirectory = ctrl.createMock(StateDirectory.class); + final ProcessorStateManager stateManager = mock(ProcessorStateManager.class); + when(stateManager.taskType()).thenReturn(TaskType.ACTIVE); + stateDirectory = mock(StateDirectory.class); - stateManager.registerGlobalStateStores(emptyList()); - EasyMock.expectLastCall(); + doNothing().when(stateManager).registerGlobalStateStores(emptyList()); - EasyMock.expect(stateManager.taskId()).andReturn(taskId); + when(stateManager.taskId()).thenReturn(taskId); - EasyMock.expect(stateDirectory.lock(taskId)).andReturn(true); + when(stateDirectory.lock(taskId)).thenReturn(true); - stateManager.close(); - EasyMock.expectLastCall(); + doNothing().when(stateManager).close(); Review Comment: No, it is already verified later on, removed -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org