2012-04-22 104 views
0

我從Jmock的主頁上閱讀了關於matchers的信息,並且在頂部有一個關於字符串匹配器的示例。我不明白,因爲根據示例,匹配一個字符串就像編寫import static org.hamcrest.Matchers。*一樣簡單;然後使用stringContains函數,但這不適用於我的實現。Jmock完全匹配字符串參數

所有我想要做的就是

new Expectations() {{ 
    mockedType.someFunction(with( **match string here** )); 
}}; 

回答

0
new Expectations() {{ 
    allowing(mockedType).someFunction("My String"); when ... ; will ... ; then ... 
}}; 

必須正常工作

相關問題