How can I do an OR operation when specifying my expectations ? The arguments can either be 10 or 11.

public void testGetRandom() {
    context.checking(new Expectations() {{
        oneOf (myrandom).isSpecific(10)  **OR** oneOf (myrandom).isSpecific(11);
    }});

    context.assertIsSatisfied();
}
有帮助吗?

解决方案

you want to use argument matches - last one

example (untested):

oneOf (myrandom).isSpecific(with(anyOf(10,11)));
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top