divijvaidya commented on code in PR #12777:
URL: https://github.com/apache/kafka/pull/12777#discussion_r1002953413


##########
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 don't think we require `reset` here because `cache` member is being reset 
already in `setUpCloseTests` just in the previous line. Same for `underlying` 
store and other tests.



-- 
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]

Reply via email to