clolov commented on code in PR #14716:
URL: https://github.com/apache/kafka/pull/14716#discussion_r1553347186
##########
streams/src/test/java/org/apache/kafka/streams/processor/internals/StreamTaskTest.java:
##########
@@ -312,55 +302,40 @@ 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.createNiceControl();
- final ProcessorStateManager stateManager =
ctrl.createMock(ProcessorStateManager.class);
-
EasyMock.expect(stateManager.taskType()).andStubReturn(TaskType.ACTIVE);
- stateDirectory = ctrl.createMock(StateDirectory.class);
+ public void
shouldAttemptToDeleteStateDirectoryWhenCloseDirtyAndEosEnabled() {
+ when(stateManager.taskType()).thenReturn(TaskType.ACTIVE);
+ stateDirectory = mock(StateDirectory.class);
- stateManager.registerGlobalStateStores(emptyList());
- EasyMock.expectLastCall();
-
- EasyMock.expect(stateManager.taskId()).andReturn(taskId);
-
- EasyMock.expect(stateDirectory.lock(taskId)).andReturn(true);
-
- stateManager.close();
- EasyMock.expectLastCall();
-
- stateManager.transitionTaskState(SUSPENDED);
Review Comment:
When I moved these to verifications Mockito claimed they were never called
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]