shekhar-rajak commented on code in PR #12777: URL: https://github.com/apache/kafka/pull/12777#discussion_r1004126495
########## streams/src/test/java/org/apache/kafka/streams/state/internals/TimeOrderedWindowStoreTest.java: ########## @@ -1166,58 +1164,47 @@ public void shouldNotThrowInvalidBackwardRangeExceptionWithNegativeFromKey() { @Test public void shouldCloseCacheAndWrappedStoreAfterErrorDuringCacheFlush() { setUpCloseTests(); - EasyMock.reset(cache); - cache.flush(CACHE_NAMESPACE); - EasyMock.expectLastCall().andThrow(new RuntimeException("Simulating an error on flush")); - cache.close(CACHE_NAMESPACE); - EasyMock.replay(cache); - EasyMock.reset(underlyingStore); - underlyingStore.close(); - EasyMock.replay(underlyingStore); + reset(cache); + doThrow(new RuntimeException( + "Simulating an error on flush")) + .when(cache).flush(CACHE_NAMESPACE); + reset(underlyingStore); assertThrows(RuntimeException.class, cachingStore::close); - EasyMock.verify(cache, underlyingStore); + verifyAndTearDownCloseTests(); } @Test public void shouldCloseWrappedStoreAfterErrorDuringCacheClose() { setUpCloseTests(); - EasyMock.reset(cache); - cache.flush(CACHE_NAMESPACE); - cache.close(CACHE_NAMESPACE); - EasyMock.expectLastCall().andThrow(new RuntimeException("Simulating an error on close")); - EasyMock.replay(cache); - EasyMock.reset(underlyingStore); - underlyingStore.close(); - EasyMock.replay(underlyingStore); + reset(cache); + doThrow(new RuntimeException("Simulating an error on close")) + .when(cache).close(CACHE_NAMESPACE); + reset(underlyingStore); assertThrows(RuntimeException.class, cachingStore::close); - EasyMock.verify(cache, underlyingStore); + verifyAndTearDownCloseTests(); } @Test public void shouldCloseCacheAfterErrorDuringStateStoreClose() { setUpCloseTests(); - EasyMock.reset(cache); - cache.flush(CACHE_NAMESPACE); - cache.close(CACHE_NAMESPACE); - EasyMock.replay(cache); - EasyMock.reset(underlyingStore); - underlyingStore.close(); - EasyMock.expectLastCall().andThrow(new RuntimeException("Simulating an error on close")); - EasyMock.replay(underlyingStore); + reset(cache); Review Comment: I think you are saying it is getting reset with the previous test case last line `verifyAndTearDownCloseTests();` . I have removed these `reset`. Thanks! -- 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