我一直遇到以下错误:
org.apache.kafka.connect.runtime.distributed.DistributedHerderTest > testCreateConnector FAILED
java.lang.AssertionError:
Unexpected method call Worker.getConnectorType("sourceB"):
Worker.getPlugins(): expected: 3, actual: 0
at org.easymock.internal.MockInvocationHandler.invoke(MockInvocationHandler.java:44)
at org.easymock.internal.ObjectMethodsFilter.invoke(ObjectMethodsFilter.java:94)
at org.easymock.internal.ClassProxyFactory$MockMethodInterceptor.intercept(ClassProxyFactory.java:97)
at org.apache.kafka.connect.runtime.Worker$$EnhancerByCGLIB$$124447d.getConnectorType(<generated>)
at org.apache.kafka.connect.runtime.distributed.DistributedHerderTest.testCreateConnector(DistributedHerderTest.java:344)
即使我输入了:
EasyMock.expect(worker.getConnectorType(CONN2)).andReturn(ConnectorType.SOURCE);
可以在此处找到代码:https://github.com/apache/kafka/pull/3812
欢迎提出建议。
答案 0 :(得分:0)
您可能需要将Worker.class
添加到@PrepareForTest({DistributedHerder.class, Plugins.class})
。