Authored by chenchao

add unit test case

... ... @@ -13,6 +13,20 @@ import static java.math.BigDecimal.ROUND_HALF_UP;
public class SellerEarnestMoney2BuyerPenaltyCalculatorTest {
@Test
public void testCalculate(){
String feeMetaValStr = "{\"bankTransferfee\":0.09,\"earnestMoney\":{\"earnestMoney\":1,\"max\":4,\"min\":1,\"prdSalePrice\":9,\"rate\":0.04},\"income\":8.26,\"platformFee\":{\"appraiseFee\":0.10,\"packageFee\":0.10,\"serviceFee\":0.45,\"total\":0.65},\"serviceFeeRate\":{\"goodsPaymentRate\":0.05,\"goodsPaymentRatePercent\":\"5.00%\",\"payChannelPercent\":\"1.00%\",\"payChannelRate\":0.01}}";
SellerOrderMeta feeMeta = new SellerOrderMeta();
feeMeta.setUid(500031170);
feeMeta.setSkup(16720);
feeMeta.setMetaKey("fee");
feeMeta.setMetaValue(feeMetaValStr);
PenaltyResult penaltyResult = SellerEarnestMoney2BuyerPenaltyCalculator.from(feeMeta).calculate().orElse(null);
System.out.println("in testCalculate penaltyResult ->" + penaltyResult);
}
@Test
public void calculate() {
JSONObject feeMetaValue = new JSONObject()
.fluentPut("bankTransferfee", 0.01)
... ...