2013-02-15 47 views
2

如何在指定期望值時進行OR操作?該參數可以是10或11或期望值

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

    context.assertIsSatisfied(); 
} 

回答

1

要使用argument matches - 最後一個

例子(未經測試):

oneOf (myrandom).isSpecific(with(anyOf(10,11)));