【问题标题】:Why mockito returns error eve argument are identical?为什么 mockito 返回错误 eve 参数是相同的?
【发布时间】:2012-07-12 11:24:43
【问题描述】:

看看这张照片。 Mockito 验证 Argument 发生了什么?

我想验证是否使用参数工厂调用了视图。

 @Test
  public void shouldInitializeTheDriverWithTheRequestFactory() {

    CVProxy proxy = context.create(CVProxy.class);

    workflow.initialize();

    verify(view).initializeWithRequestFactory(factory);

    verify(view).editWithEditor(proxy, context);

  }

但是我得到了这个奇怪的错误?!

Argument(s) are different! Wanted:
view.initializeWithRequestFactory(
    com.google.web.bindery.requestfactory.vm.InProcessRequestFactory@13c6a22
);
-> at CreatingNewCVWorkflowTest.shouldInitializeTheDriverWithTheRequestFactory(CreatingNewCVWorkflowTest.java:53)
Actual invocation has different arguments:
view.initializeWithRequestFactory(
    com.google.web.bindery.requestfactory.vm.InProcessRequestFactory@13c6a22
);

您可以使用相同的参数。

【问题讨论】:

    标签: testing junit4 mockito hamcrest


    【解决方案1】:

    是否可能是工厂实例有错误实现的equals方法(以至于equals方法报告对象不等于自身)?

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-22
    • 1970-01-01
    • 2020-04-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多