一、gradle 单元测试代码
@Test
public void posterTest() throws Exception {
long startTime = System.currentTimeMillis();
ProductService service = new FakeProductService();
Product product = service.get(0L);
Map<String, String> params = new HashMap<>();
params.put("width", "11024");
params.put("height", "7874");
params.put("pictureIds", "1524461,1524462");
}
使用了junit5.4
二、mac 中idea 中启动单元测试步骤
选择Edit Configurations
add New Configuration
run 中配置你的单元测试类信息
:main:test --tests "com.fancv.first.Tester"
注意
直接使用右键 run 会报模块找不到的错误
总结
gradle 适合Android 开发配置,对于一般的服务端项目,不建议使用。