English 中文(简体)
简便磁力:一套元件中的光谱数
原标题:EasyMock: Expect Number of Elements in a Set

你们如何核实一组简易磁盘中的内容数量? 第1类检测应采用一种方法,采用n元素。 现在,我与名单上的任何物体相匹配:

    mockFooSetReceiver.saveFooSet(eq(name), 
            (List<IFooSet>) anyObject());
    replay(mockFooSetReceiver);

我愿具体指出:

    mockFooSetReceiver.saveFooSet(eq(name), 
            setOfNObject(100));
    replay(mockFooSetReceiver);

Or better yet, match the elements in the set:

    mockFooSetReceiver.saveFooSet(eq(name), 
            setEq(ecpectedSet));
    replay(mockFooSetReceiver);

我是否必须自行开车,是否建在其中? 或者有人有<条码>、正文/代码>或<条码>。 他们想要分享的比喻?

最佳回答

根据这一合同,《原则和规则》必须执行:

Compares the specified object with this set for equality. Returns true if the specified object is also a set, the two sets have the same size, and every member of the specified set is contained in this set (or equivalently, every member of this set is contained in the specified set). This definition ensures that the equals method works properly across different implementations of the set interface.

简单易懂的Mock.eq (ecpectedSet) 就是做的。

如果只计算固定的@Guillaume的答案是行走的道路。

问题回答

页: 1 方法:

  1. check the number of arguments
  2. cast the set argument to a Set
  3. check the length

我手头没有类似的同业者。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签