You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2022/11/02 10:30:29 UTC
[GitHub] [kafka] clolov commented on a diff in pull request #12505: KAFKA-14133: Replace EasyMock with Mockito in streams tests
clolov commented on code in PR #12505:
URL: https://github.com/apache/kafka/pull/12505#discussion_r1011531468
##########
streams/src/test/java/org/apache/kafka/streams/state/internals/CachingInMemoryKeyValueStoreTest.java:
##########
@@ -105,26 +112,20 @@ protected <K, V> KeyValueStore<K, V> createKeyValueStore(final StateStoreContext
@SuppressWarnings("deprecation")
@Test
public void shouldDelegateDeprecatedInit() {
- final KeyValueStore<Bytes, byte[]> inner = EasyMock.mock(InMemoryKeyValueStore.class);
+ final KeyValueStore<Bytes, byte[]> inner = mock(InMemoryKeyValueStore.class);
final CachingKeyValueStore outer = new CachingKeyValueStore(inner, false);
- EasyMock.expect(inner.name()).andStubReturn("store");
- inner.init((ProcessorContext) context, outer);
- EasyMock.expectLastCall();
- EasyMock.replay(inner);
+ when(inner.name()).thenReturn("store");
outer.init((ProcessorContext) context, outer);
- EasyMock.verify(inner);
+ verify(inner).init(eq((ProcessorContext) context), eq(outer));
}
@Test
public void shouldDelegateInit() {
- final KeyValueStore<Bytes, byte[]> inner = EasyMock.mock(InMemoryKeyValueStore.class);
+ final KeyValueStore<Bytes, byte[]> inner = mock(InMemoryKeyValueStore.class);
final CachingKeyValueStore outer = new CachingKeyValueStore(inner, false);
- EasyMock.expect(inner.name()).andStubReturn("store");
- inner.init((StateStoreContext) context, outer);
- EasyMock.expectLastCall();
- EasyMock.replay(inner);
+ when(inner.name()).thenReturn("store");
outer.init((StateStoreContext) context, outer);
- EasyMock.verify(inner);
+ verify(inner).init(eq((StateStoreContext) context), eq(outer));
Review Comment:
We do not need it here. I will make another pass through the pull request to remove them.
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org