junit代码覆盖率ForEach循环未覆盖

时间:2019-01-31 19:42:30

标签: junit code-coverage

我用forEach循环编写了一个Java类,该类迭代对象列表。请参见下面的代码。

public List<Customer> getBranchDealersForDealer(String orgId, String regionId, String districtId, String dealerCode) {
    List<Customer> branchDealers = customerRepository.branchDealersForDealer(orgId, regionId, districtId, dealerCode);
    for(Customer c : branchDealers){
        c.setOrgId(orgId);
        c.setRegionId(regionId);
        c.setDistrictId(districtId);
    }
    List<WarrantyDealerView> warrantyBranchDealers =
    warrantyDealerService.getDealersForCodesIn(toDealerIds(branchDealers));
    return applyUpdatesFromWarranty(branchDealers, warrantyBranchDealers, true);
}

如何为该forEach循环编写代码覆盖率。

测试用例代码:

dealerService.getBranchDealersForDealer("NACD", "USEAST", "SEATLE", "SEATLE");

0 个答案:

没有答案