Open xiaoweibahaha opened 1 year ago
输出的结果 *****a ---1a a
日志: [INFO] Start at Tue Apr 25 21:41:11 CST 2023 [INFO] TestableMock start at /Users/didi/Desktop/zhaoxw/workspace/risk-management-service/risk-management-service-20230403_page [INFO] Found test class cn/sunline/risk/management/DemoTest [INFO] Found 2 test cases [INFO] Completed at Tue Apr 25 21:42:38 CST 2023
package cn.sunline.risk.management;
import com.alibaba.testable.core.annotation.MockMethod; import org.junit.Assert; import org.junit.jupiter.api.Test; import org.mockito.Mockito; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.stereotype.Component;
@SpringBootTest(classes = Application.class) public class DemoTest { @Autowired private DemoService1 demoService1;
/* String a = "zhao"; Mockito.when(demoService1.test2(a)).thenReturn("zhaoxiaowei_v"); Mockito.when(demoService1.test3(a)).thenReturn("zhaoxiaowei_v");
*/
}
@Component class DemoService{ @Autowired DemoService1 demoService1;
} @Component class DemoService1{
}