EasyMock模拟方法,使用不同数量的参数调用相同的方法

问题描述 投票:0回答:1

我有方法:

public List<MyObject<?>> send(List<Product> products,
                                     Type type,
                                     User user) {
        return send(products, type, user, false);
    }

该呼叫:

public List<MyObject<?>> send(List<Product> products,
                                     Type type,
                                     User user,
                                     boolean ignore) {
        return send(products, type,  user, ignore, false);
    }

该呼叫:

public List<MyObject<?>> send(List<Product> products,
                                     Type type,
                                     User user,
                                     boolean ignore,
                                     boolean manual) {
    method body
}

我知道对于只返回ArrayList<MyObject<?>>的方法,我可以这样做:

expect(Sender.sendFeeds(products, types, user)).andReturn(new ArrayList<MyObject<?>>());

但是在上例中如何处理Unexpected method call

java mocking easymock
1个回答
0
投票

一个完整的例子对于给出明确的答案是必要的。

© www.soinside.com 2019 - 2024. All rights reserved.