优化
This commit is contained in:
@@ -938,11 +938,11 @@ class SmartLoadingServiceTest {
|
|||||||
void allowsVolumeAndWeightWithinOneHundredFiftyPercent() {
|
void allowsVolumeAndWeightWithinOneHundredFiftyPercent() {
|
||||||
stubAssignment();
|
stubAssignment();
|
||||||
ContainerBookingEntity tolerant = booking();
|
ContainerBookingEntity tolerant = booking();
|
||||||
tolerant.setCapacityCbm(new BigDecimal("0.6666667"));
|
tolerant.setCapacityCbm(new BigDecimal("1"));
|
||||||
tolerant.setMaxWeightKg(new BigDecimal("2.6666667"));
|
tolerant.setMaxWeightKg(new BigDecimal("4"));
|
||||||
when(repository.booking(99L)).thenReturn(tolerant);
|
when(repository.booking(99L)).thenReturn(tolerant);
|
||||||
|
|
||||||
service.assign(1, new AssignRequest(10L, 20L, 2, 0, "assign-150-ok"), 7, "u");
|
service.assign(1, new AssignRequest(10L, 20L, 3, 0, "assign-150-ok"), 7, "u");
|
||||||
|
|
||||||
verify(splitPreloadService).ensurePendingForLoadingAllocation(9L, 10L, 7L, "u");
|
verify(splitPreloadService).ensurePendingForLoadingAllocation(9L, 10L, 7L, "u");
|
||||||
verify(repository).touch(1, 0, 7, "u");
|
verify(repository).touch(1, 0, 7, "u");
|
||||||
@@ -952,12 +952,12 @@ class SmartLoadingServiceTest {
|
|||||||
void rejectsVolumeOrWeightAboveOneHundredFiftyPercent() {
|
void rejectsVolumeOrWeightAboveOneHundredFiftyPercent() {
|
||||||
stubAssignment();
|
stubAssignment();
|
||||||
ContainerBookingEntity exceeded = booking();
|
ContainerBookingEntity exceeded = booking();
|
||||||
exceeded.setCapacityCbm(new BigDecimal("0.6666"));
|
exceeded.setCapacityCbm(new BigDecimal("0.9999"));
|
||||||
exceeded.setMaxWeightKg(new BigDecimal("2.6666"));
|
exceeded.setMaxWeightKg(new BigDecimal("3.9999"));
|
||||||
when(repository.booking(99L)).thenReturn(exceeded);
|
when(repository.booking(99L)).thenReturn(exceeded);
|
||||||
|
|
||||||
BizException error = catchThrowableOfType(() -> service.assign(1,
|
BizException error = catchThrowableOfType(() -> service.assign(1,
|
||||||
new AssignRequest(10L, 20L, 2, 0, "assign-150-exceeded"), 7, "u"), BizException.class);
|
new AssignRequest(10L, 20L, 3, 0, "assign-150-exceeded"), 7, "u"), BizException.class);
|
||||||
|
|
||||||
assertThat(error.getResultCode()).isEqualTo(ResultCode.VALIDATION_FAILED);
|
assertThat(error.getResultCode()).isEqualTo(ResultCode.VALIDATION_FAILED);
|
||||||
assertThat(error.getMessage()).contains("150%");
|
assertThat(error.getMessage()).contains("150%");
|
||||||
|
|||||||
Reference in New Issue
Block a user