feat: close overseas wallet and pallet cost flow
This commit is contained in:
+20
@@ -0,0 +1,20 @@
|
||||
package com.baiyue.lastleg.inboundplan.service;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
|
||||
class DestuffingPalletCostServiceTest {
|
||||
@Test void preservesTotalAndLetsFinalCustomerAbsorbRoundingRemainder() {
|
||||
List<BigDecimal> result = DestuffingPalletCostService.allocate(new BigDecimal("10.00"),
|
||||
List.of(new BigDecimal("1"), new BigDecimal("1"), new BigDecimal("1")));
|
||||
assertThat(result).containsExactly(new BigDecimal("3.33"), new BigDecimal("3.33"), new BigDecimal("3.34"));
|
||||
assertThat(result.stream().reduce(BigDecimal.ZERO, BigDecimal::add)).isEqualByComparingTo("10.00");
|
||||
}
|
||||
@Test void rejectsZeroActualVolume() {
|
||||
assertThatThrownBy(() -> DestuffingPalletCostService.allocate(BigDecimal.ONE, List.of(BigDecimal.ZERO)))
|
||||
.isInstanceOf(IllegalArgumentException.class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user