Authored by wujiexiang

增加便于测试的方法

package com.yohoufo.order.model.bo;
import com.google.common.annotations.VisibleForTesting;
import com.yohoufo.order.utils.BeanTool;
import lombok.Data;
import lombok.ToString;
... ... @@ -22,7 +23,9 @@ public class PlatformServiceFeeDefinition {
//费用规则 按照threshold从小到大排序
private List<FeeRule> rules = new ArrayList<>();
public void setRules(List<FeeRule> rules) {
@VisibleForTesting
public void setAndSortRules(List<FeeRule> rules) {
this.rules = rules;
sortRules(Comparator.comparing(FeeRule::getThreshold).reversed());
}
... ...
... ... @@ -156,7 +156,7 @@ public class SellerOrderQuantityStatsTest {
three.setRate(BigDecimal.valueOf(0.035));
three.setThreshold(0);
psfd.setRules(Lists.newArrayList(one, two, three));
psfd.setAndSortRules(Lists.newArrayList(one, two, three));
return SellerServiceFeeRuleDefinition.builder().serviceFeeDefinition(psfd).statsCode(statCode).enterType(EntrySellerType.NOT_ENTRY.getCode()).build();
}
... ... @@ -175,7 +175,7 @@ public class SellerOrderQuantityStatsTest {
three.setRate(BigDecimal.valueOf(0.015));
three.setThreshold(20);
psfd.setRules(Lists.newArrayList(one, two, three));
psfd.setAndSortRules(Lists.newArrayList(one, two, three));
return SellerServiceFeeRuleDefinition.builder().serviceFeeDefinition(psfd).statsCode(statCode).enterType(EntrySellerType.COMMON.getCode()).build();
}
... ... @@ -194,7 +194,7 @@ public class SellerOrderQuantityStatsTest {
three.setRate(BigDecimal.valueOf(0.005));
three.setThreshold(0);
psfd.setRules(Lists.newArrayList(one, two, three));
psfd.setAndSortRules(Lists.newArrayList(one, two, three));
return SellerServiceFeeRuleDefinition.builder().serviceFeeDefinition(psfd).statsCode(statCode).enterType(EntrySellerType.COMMON.getCode()).build();
}
... ...