我試圖捕獲在輸入傳遞到與PowerMockito模擬對象的參數,這是代碼: //I create a mock object
ClassMocked mock = PowerMockito.mock(ClassMocked.class);
//Create the captor that will capture the String passed in input to the mock
我做了一個方法來計算String中給定字符的出現次數。 public Integer numberOf(String str, Character a){}
我試圖測試正常使用: @Test
public void test1(){
Integer result = oc.numberOf("Lungimirante", 'u');
Assert.assertEquals
我是mockito的新手。比方說,我有這樣 public class MyClass {
int a;
String b;
public MyClass(int a) {
this.a = a;
this.b = draw();
System.out.println("class is created");
}