|
|
@@ -55,6 +55,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
|
|
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
import static org.mockito.ArgumentMatchers.any;
|
|
|
+import static org.mockito.ArgumentMatchers.anyInt;
|
|
|
import static org.mockito.ArgumentMatchers.anyString;
|
|
|
import static org.mockito.ArgumentMatchers.eq;
|
|
|
import static org.mockito.ArgumentMatchers.isNull;
|
|
|
@@ -90,8 +91,8 @@ class FlashDeliveryApplicationServiceTest {
|
|
|
@Test
|
|
|
void quoteUsesServerRouteAndCurrentTimePricing() {
|
|
|
Fixture fixture = new Fixture();
|
|
|
- when(fixture.pricingMapper.selectAtTime(anyString())).thenReturn(List.of(pricing()));
|
|
|
- when(fixture.routeService.calculate(any(), any())).thenReturn(new RouteDistance(3001, 600, "ROUTE"));
|
|
|
+ when(fixture.pricingMapper.selectAtTime(anyString(), anyInt())).thenReturn(List.of(pricing()));
|
|
|
+ when(fixture.routeService.calculate(any(), any(), anyInt())).thenReturn(new RouteDistance(3001, 600, "ROUTE"));
|
|
|
|
|
|
var quote = fixture.service.quote(request());
|
|
|
|
|
|
@@ -106,8 +107,8 @@ class FlashDeliveryApplicationServiceTest {
|
|
|
@Test
|
|
|
void quoteRejectsRoutesLongerThanFortyKilometres() {
|
|
|
Fixture fixture = new Fixture();
|
|
|
- when(fixture.pricingMapper.selectAtTime(anyString())).thenReturn(List.of(pricing()));
|
|
|
- when(fixture.routeService.calculate(any(), any())).thenReturn(new RouteDistance(40001, 1800, "ROUTE"));
|
|
|
+ when(fixture.pricingMapper.selectAtTime(anyString(), anyInt())).thenReturn(List.of(pricing()));
|
|
|
+ when(fixture.routeService.calculate(any(), any(), anyInt())).thenReturn(new RouteDistance(40001, 1800, "ROUTE"));
|
|
|
|
|
|
assertThrows(ServiceException.class, () -> fixture.service.quote(request()));
|
|
|
}
|
|
|
@@ -169,8 +170,8 @@ class FlashDeliveryApplicationServiceTest {
|
|
|
Fixture fixture = new Fixture();
|
|
|
when(fixture.userMapper.selectOrdinaryUserIdsByNormalizedPhone("0922222222"))
|
|
|
.thenReturn(List.of(88L));
|
|
|
- when(fixture.pricingMapper.selectAtTime(anyString())).thenReturn(List.of(pricing()));
|
|
|
- when(fixture.routeService.calculate(any(), any())).thenReturn(new RouteDistance(3200, 600, "ROUTE"));
|
|
|
+ when(fixture.pricingMapper.selectAtTime(anyString(), anyInt())).thenReturn(List.of(pricing()));
|
|
|
+ when(fixture.routeService.calculate(any(), any(), anyInt())).thenReturn(new RouteDistance(3200, 600, "ROUTE"));
|
|
|
doAnswer(invocation -> {
|
|
|
FlashDeliveryOrder order = invocation.getArgument(0);
|
|
|
order.setId(99L);
|
|
|
@@ -244,8 +245,8 @@ class FlashDeliveryApplicationServiceTest {
|
|
|
@Test
|
|
|
void createDoesNotBindReceiverWhenNormalizedPhoneMatchesMultipleUsers() {
|
|
|
Fixture fixture = new Fixture();
|
|
|
- when(fixture.pricingMapper.selectAtTime(anyString())).thenReturn(List.of(pricing()));
|
|
|
- when(fixture.routeService.calculate(any(), any())).thenReturn(new RouteDistance(3200, 600, "ROUTE"));
|
|
|
+ when(fixture.pricingMapper.selectAtTime(anyString(), anyInt())).thenReturn(List.of(pricing()));
|
|
|
+ when(fixture.routeService.calculate(any(), any(), anyInt())).thenReturn(new RouteDistance(3200, 600, "ROUTE"));
|
|
|
when(fixture.userMapper.selectOrdinaryUserIdsByNormalizedPhone("886912345678"))
|
|
|
.thenReturn(List.of(88L, 99L));
|
|
|
doAnswer(invocation -> {
|
|
|
@@ -266,8 +267,8 @@ class FlashDeliveryApplicationServiceTest {
|
|
|
@Test
|
|
|
void createLeavesReceiverUnboundWhenPhoneHasNoRegisteredUser() {
|
|
|
Fixture fixture = new Fixture();
|
|
|
- when(fixture.pricingMapper.selectAtTime(anyString())).thenReturn(List.of(pricing()));
|
|
|
- when(fixture.routeService.calculate(any(), any())).thenReturn(new RouteDistance(3200, 600, "ROUTE"));
|
|
|
+ when(fixture.pricingMapper.selectAtTime(anyString(), anyInt())).thenReturn(List.of(pricing()));
|
|
|
+ when(fixture.routeService.calculate(any(), any(), anyInt())).thenReturn(new RouteDistance(3200, 600, "ROUTE"));
|
|
|
when(fixture.userMapper.selectOrdinaryUserIdsByNormalizedPhone("0922222222"))
|
|
|
.thenReturn(List.of());
|
|
|
doAnswer(invocation -> {
|
|
|
@@ -336,9 +337,11 @@ class FlashDeliveryApplicationServiceTest {
|
|
|
var parameters = query.getValue().getParamNameValuePairs().values();
|
|
|
assertTrue(sql.contains("status"));
|
|
|
assertTrue(sql.contains("rider_id is null"));
|
|
|
+ assertTrue(sql.contains("vehicle_type"));
|
|
|
assertTrue(sql.contains("scheduled_pickup_start_at"));
|
|
|
assertTrue(sql.contains("st_distance_sphere"));
|
|
|
assertTrue(parameters.contains("WAITING_ACCEPTANCE"));
|
|
|
+ assertTrue(parameters.contains(1));
|
|
|
assertTrue(parameters.contains("NOW"));
|
|
|
assertTrue(parameters.stream().anyMatch(Date.class::isInstance));
|
|
|
|
|
|
@@ -348,6 +351,7 @@ class FlashDeliveryApplicationServiceTest {
|
|
|
String summarySql = summaryQuery.getValue().getSqlSegment().toLowerCase();
|
|
|
var summaryParameters = summaryQuery.getValue().getParamNameValuePairs().values();
|
|
|
assertTrue(summarySql.contains("rider_id is null"));
|
|
|
+ assertTrue(summarySql.contains("vehicle_type"));
|
|
|
assertTrue(summarySql.contains("scheduled_pickup_start_at"));
|
|
|
assertTrue(summarySql.contains("st_distance_sphere"));
|
|
|
assertTrue(summaryParameters.contains("WAITING_ACCEPTANCE"));
|
|
|
@@ -655,7 +659,7 @@ class FlashDeliveryApplicationServiceTest {
|
|
|
void concurrentPricingUpdateIsRejected() {
|
|
|
Fixture fixture = new Fixture();
|
|
|
when(fixture.pricingMapper.selectById(1L)).thenReturn(pricing());
|
|
|
- when(fixture.pricingMapper.countOverlapping("00:00", "12:00", 1L)).thenReturn(0);
|
|
|
+ when(fixture.pricingMapper.countOverlapping("00:00", "12:00", 1, 1L)).thenReturn(0);
|
|
|
when(fixture.pricingMapper.update(isNull(), any(Wrapper.class))).thenReturn(0);
|
|
|
FlashDeliveryPricingRequest request = pricingRequest();
|
|
|
request.setEndTime("12:00");
|
|
|
@@ -670,7 +674,7 @@ class FlashDeliveryApplicationServiceTest {
|
|
|
void overlappingPricingPeriodIsRejectedBeforeInsert() {
|
|
|
Fixture fixture = new Fixture();
|
|
|
FlashDeliveryPricingRequest request = pricingRequest();
|
|
|
- when(fixture.pricingMapper.countOverlapping("00:00", "24:00", null)).thenReturn(1);
|
|
|
+ when(fixture.pricingMapper.countOverlapping("00:00", "24:00", 1, null)).thenReturn(1);
|
|
|
|
|
|
assertThrows(ServiceException.class, () -> fixture.service.createPricing(1L, request));
|
|
|
|
|
|
@@ -708,7 +712,7 @@ class FlashDeliveryApplicationServiceTest {
|
|
|
void createPricingPersistsImmediatelyActiveTimePeriod() {
|
|
|
Fixture fixture = new Fixture();
|
|
|
FlashDeliveryPricingRequest request = pricingRequest();
|
|
|
- when(fixture.pricingMapper.countOverlapping("00:00", "24:00", null)).thenReturn(0);
|
|
|
+ when(fixture.pricingMapper.countOverlapping("00:00", "24:00", 1, null)).thenReturn(0);
|
|
|
|
|
|
fixture.service.createPricing(7L, request);
|
|
|
|
|
|
@@ -720,7 +724,7 @@ class FlashDeliveryApplicationServiceTest {
|
|
|
|
|
|
InOrder writeOrder = inOrder(fixture.pricingMapper);
|
|
|
writeOrder.verify(fixture.pricingMapper)
|
|
|
- .countOverlapping("00:00", "24:00", null);
|
|
|
+ .countOverlapping("00:00", "24:00", 1, null);
|
|
|
writeOrder.verify(fixture.pricingMapper).insert(any(FlashDeliveryPricing.class));
|
|
|
}
|
|
|
|
|
|
@@ -737,18 +741,18 @@ class FlashDeliveryApplicationServiceTest {
|
|
|
|
|
|
assertThrows(ServiceException.class, () -> fixture.service.quote(request()));
|
|
|
|
|
|
- verify(fixture.routeService, never()).calculate(any(), any());
|
|
|
+ verify(fixture.routeService, never()).calculate(any(), any(), anyInt());
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
void multipleCurrentPricingPeriodsFailExplicitlyBeforeRouteLookup() {
|
|
|
Fixture fixture = new Fixture();
|
|
|
- when(fixture.pricingMapper.selectAtTime(anyString()))
|
|
|
+ when(fixture.pricingMapper.selectAtTime(anyString(), anyInt()))
|
|
|
.thenReturn(List.of(pricing(), pricing()));
|
|
|
|
|
|
assertThrows(ServiceException.class, () -> fixture.service.quote(request()));
|
|
|
|
|
|
- verify(fixture.routeService, never()).calculate(any(), any());
|
|
|
+ verify(fixture.routeService, never()).calculate(any(), any(), anyInt());
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
@@ -759,12 +763,14 @@ class FlashDeliveryApplicationServiceTest {
|
|
|
when(fixture.pricingMapper.update(isNull(), any(Wrapper.class))).thenReturn(1);
|
|
|
FlashDeliveryPricingRequest request = pricingRequest();
|
|
|
request.setConfigVersion(1);
|
|
|
+ request.setVehicleType(2);
|
|
|
|
|
|
- fixture.service.updatePricing(9L, 1L, request);
|
|
|
+ FlashDeliveryPricing updated = fixture.service.updatePricing(9L, 1L, request);
|
|
|
+ assertEquals(2, updated.getVehicleType());
|
|
|
|
|
|
InOrder writeOrder = inOrder(fixture.pricingMapper);
|
|
|
writeOrder.verify(fixture.pricingMapper)
|
|
|
- .countOverlapping("00:00", "24:00", 1L);
|
|
|
+ .countOverlapping("00:00", "24:00", 2, 1L);
|
|
|
writeOrder.verify(fixture.pricingMapper).update(isNull(), any(Wrapper.class));
|
|
|
}
|
|
|
|
|
|
@@ -782,8 +788,8 @@ class FlashDeliveryApplicationServiceTest {
|
|
|
@Test
|
|
|
void urgentQuoteReturnsSeparatedFeesAndUsesScheduledPickupTime() {
|
|
|
Fixture fixture = new Fixture();
|
|
|
- when(fixture.pricingMapper.selectAtTime("16:30")).thenReturn(List.of(pricing()));
|
|
|
- when(fixture.routeService.calculate(any(), any())).thenReturn(new RouteDistance(6000, 900, "ROUTE"));
|
|
|
+ when(fixture.pricingMapper.selectAtTime("16:30", 1)).thenReturn(List.of(pricing()));
|
|
|
+ when(fixture.routeService.calculate(any(), any(), anyInt())).thenReturn(new RouteDistance(6000, 900, "ROUTE"));
|
|
|
FlashDeliveryQuoteRequest request = request();
|
|
|
request.setDeliveryType("URGENT");
|
|
|
request.setTipAmount(5L);
|
|
|
@@ -804,14 +810,14 @@ class FlashDeliveryApplicationServiceTest {
|
|
|
assertEquals(27L, quote.getUrgentFee());
|
|
|
assertEquals(5L, quote.getTipAmount());
|
|
|
assertEquals(167L, quote.getAmount());
|
|
|
- verify(fixture.pricingMapper).selectAtTime("16:30");
|
|
|
+ verify(fixture.pricingMapper).selectAtTime("16:30", 1);
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
void createRejectsChangedQuoteAndReturnsLatestQuoteWithoutInsert() {
|
|
|
Fixture fixture = new Fixture();
|
|
|
- when(fixture.pricingMapper.selectAtTime(anyString())).thenReturn(List.of(pricing()));
|
|
|
- when(fixture.routeService.calculate(any(), any())).thenReturn(new RouteDistance(3200, 600, "ROUTE"));
|
|
|
+ when(fixture.pricingMapper.selectAtTime(anyString(), anyInt())).thenReturn(List.of(pricing()));
|
|
|
+ when(fixture.routeService.calculate(any(), any(), anyInt())).thenReturn(new RouteDistance(3200, 600, "ROUTE"));
|
|
|
FlashDeliveryCreateRequest request = createRequest();
|
|
|
request.setQuotedAmount(91L);
|
|
|
|
|
|
@@ -826,8 +832,8 @@ class FlashDeliveryApplicationServiceTest {
|
|
|
@Test
|
|
|
void createDefaultsPayTypeToCashAndStoresTransferSelection() {
|
|
|
Fixture fixture = new Fixture();
|
|
|
- when(fixture.pricingMapper.selectAtTime(anyString())).thenReturn(List.of(pricing()));
|
|
|
- when(fixture.routeService.calculate(any(), any())).thenReturn(new RouteDistance(3200, 600, "ROUTE"));
|
|
|
+ when(fixture.pricingMapper.selectAtTime(anyString(), anyInt())).thenReturn(List.of(pricing()));
|
|
|
+ when(fixture.routeService.calculate(any(), any(), anyInt())).thenReturn(new RouteDistance(3200, 600, "ROUTE"));
|
|
|
doAnswer(invocation -> {
|
|
|
FlashDeliveryOrder order = invocation.getArgument(0);
|
|
|
order.setId(99L);
|
|
|
@@ -852,8 +858,8 @@ class FlashDeliveryApplicationServiceTest {
|
|
|
@Test
|
|
|
void createRejectsUnsupportedPayType() {
|
|
|
Fixture fixture = new Fixture();
|
|
|
- when(fixture.pricingMapper.selectAtTime(anyString())).thenReturn(List.of(pricing()));
|
|
|
- when(fixture.routeService.calculate(any(), any())).thenReturn(new RouteDistance(3200, 600, "ROUTE"));
|
|
|
+ when(fixture.pricingMapper.selectAtTime(anyString(), anyInt())).thenReturn(List.of(pricing()));
|
|
|
+ when(fixture.routeService.calculate(any(), any(), anyInt())).thenReturn(new RouteDistance(3200, 600, "ROUTE"));
|
|
|
FlashDeliveryCreateRequest request = createRequest();
|
|
|
request.setPayType("2");
|
|
|
|
|
|
@@ -884,8 +890,8 @@ class FlashDeliveryApplicationServiceTest {
|
|
|
@Test
|
|
|
void quoteAcceptsAllFourWeightRanges() {
|
|
|
Fixture fixture = new Fixture();
|
|
|
- when(fixture.pricingMapper.selectAtTime(anyString())).thenReturn(List.of(pricing()));
|
|
|
- when(fixture.routeService.calculate(any(), any())).thenReturn(new RouteDistance(3200, 600, "ROUTE"));
|
|
|
+ when(fixture.pricingMapper.selectAtTime(anyString(), anyInt())).thenReturn(List.of(pricing()));
|
|
|
+ when(fixture.routeService.calculate(any(), any(), anyInt())).thenReturn(new RouteDistance(3200, 600, "ROUTE"));
|
|
|
|
|
|
for (String weightRange : List.of("UP_TO_5_KG", "OVER_5_TO_10_KG",
|
|
|
"OVER_10_TO_15_KG", "OVER_15_TO_20_KG")) {
|
|
|
@@ -901,8 +907,8 @@ class FlashDeliveryApplicationServiceTest {
|
|
|
for (String weightRange : List.of("UP_TO_5_KG", "OVER_5_TO_10_KG",
|
|
|
"OVER_10_TO_15_KG", "OVER_15_TO_20_KG")) {
|
|
|
Fixture fixture = new Fixture();
|
|
|
- when(fixture.pricingMapper.selectAtTime(anyString())).thenReturn(List.of(pricing()));
|
|
|
- when(fixture.routeService.calculate(any(), any())).thenReturn(new RouteDistance(3200, 600, "ROUTE"));
|
|
|
+ when(fixture.pricingMapper.selectAtTime(anyString(), anyInt())).thenReturn(List.of(pricing()));
|
|
|
+ when(fixture.routeService.calculate(any(), any(), anyInt())).thenReturn(new RouteDistance(3200, 600, "ROUTE"));
|
|
|
doAnswer(invocation -> {
|
|
|
FlashDeliveryOrder order = invocation.getArgument(0);
|
|
|
order.setId(99L);
|
|
|
@@ -932,12 +938,45 @@ class FlashDeliveryApplicationServiceTest {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ void quoteUsesSelectedVehiclePricingAndRejectsUnsupportedVehicle() {
|
|
|
+ Fixture fixture = new Fixture();
|
|
|
+ FlashDeliveryPricing carPricing = pricing();
|
|
|
+ carPricing.setId(2L);
|
|
|
+ carPricing.setVehicleType(2);
|
|
|
+ carPricing.setStartingFare(180L);
|
|
|
+ when(fixture.pricingMapper.selectAtTime(anyString(), eq(2))).thenReturn(List.of(carPricing));
|
|
|
+ when(fixture.routeService.calculate(any(), any(), anyInt())).thenReturn(new RouteDistance(3200, 600, "ROUTE"));
|
|
|
+
|
|
|
+ FlashDeliveryQuoteRequest carRequest = request();
|
|
|
+ carRequest.setVehicleType(2);
|
|
|
+ assertEquals(180L, fixture.service.quote(carRequest).getAmount());
|
|
|
+ verify(fixture.routeService).calculate(any(), any(), eq(2));
|
|
|
+
|
|
|
+ FlashDeliveryQuoteRequest missingVehicle = request();
|
|
|
+ missingVehicle.setVehicleType(null);
|
|
|
+ assertThrows(ServiceException.class, () -> fixture.service.quote(missingVehicle));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ void quoteAllowsMissingWeightRangeAndSpecification() {
|
|
|
+ Fixture fixture = new Fixture();
|
|
|
+ when(fixture.pricingMapper.selectAtTime(anyString(), eq(1))).thenReturn(List.of(pricing()));
|
|
|
+ when(fixture.routeService.calculate(any(), any(), anyInt())).thenReturn(new RouteDistance(3200, 600, "ROUTE"));
|
|
|
+ FlashDeliveryQuoteRequest request = request();
|
|
|
+ request.setWeightRange(null);
|
|
|
+ request.setSpecification(null);
|
|
|
+
|
|
|
+ assertDoesNotThrow(() -> fixture.service.quote(request));
|
|
|
+ }
|
|
|
+
|
|
|
private FlashDeliveryQuoteRequest request() {
|
|
|
FlashDeliveryQuoteRequest request = new FlashDeliveryQuoteRequest();
|
|
|
request.setServiceType("HELP_SEND");
|
|
|
request.setDeliveryType("NORMAL");
|
|
|
request.setPackageType("DOCUMENT");
|
|
|
request.setQuantity(1);
|
|
|
+ request.setVehicleType(1);
|
|
|
request.setWeightRange("UP_TO_5_KG");
|
|
|
request.setSpecification("30 x 20 x 10 cm");
|
|
|
request.setTipAmount(0L);
|
|
|
@@ -953,6 +992,7 @@ class FlashDeliveryApplicationServiceTest {
|
|
|
FlashDeliveryQuoteRequest quote = request();
|
|
|
request.setServiceType(quote.getServiceType());
|
|
|
request.setDeliveryType(quote.getDeliveryType());
|
|
|
+ request.setVehicleType(quote.getVehicleType());
|
|
|
request.setPackageType(quote.getPackageType());
|
|
|
request.setQuantity(quote.getQuantity());
|
|
|
request.setWeightRange(quote.getWeightRange());
|
|
|
@@ -990,6 +1030,7 @@ class FlashDeliveryApplicationServiceTest {
|
|
|
private FlashDeliveryPricing pricing() {
|
|
|
FlashDeliveryPricing pricing = new FlashDeliveryPricing();
|
|
|
pricing.setId(1L);
|
|
|
+ pricing.setVehicleType(1);
|
|
|
pricing.setStartTime("00:00");
|
|
|
pricing.setEndTime("24:00");
|
|
|
pricing.setStartingDistance(new BigDecimal("3.00"));
|
|
|
@@ -1004,6 +1045,7 @@ class FlashDeliveryApplicationServiceTest {
|
|
|
|
|
|
private FlashDeliveryPricingRequest pricingRequest() {
|
|
|
FlashDeliveryPricingRequest request = new FlashDeliveryPricingRequest();
|
|
|
+ request.setVehicleType(1);
|
|
|
request.setStartTime("00:00");
|
|
|
request.setEndTime("24:00");
|
|
|
request.setStartingDistance(new BigDecimal("3.00"));
|
|
|
@@ -1040,6 +1082,7 @@ class FlashDeliveryApplicationServiceTest {
|
|
|
rider.setUserId(riderId);
|
|
|
rider.setUserType("2");
|
|
|
rider.setDeliveryType("FLASH");
|
|
|
+ rider.setVehicleType("1");
|
|
|
when(fixture.userMapper.selectInfoUserByUserId(riderId)).thenReturn(rider);
|
|
|
}
|
|
|
|
|
|
@@ -1129,7 +1172,7 @@ class FlashDeliveryApplicationServiceTest {
|
|
|
assertEquals(1, quote.getPricingVersion());
|
|
|
assertEquals("pickup road", order.getPickupAddress());
|
|
|
// 改址报价必须查询运价表(按定价时点取最新),不再沿用订单快照
|
|
|
- verify(fixture.pricingMapper).selectAtTime(anyString());
|
|
|
+ verify(fixture.pricingMapper).selectAtTime(anyString(), anyInt());
|
|
|
verify(fixture.orderMapper, never()).updateWaitingAddress(any(), any());
|
|
|
verify(fixture.logMapper, never()).insert(any(com.ruoyi.system.domain.flash.FlashDeliveryOrderLog.class));
|
|
|
}
|
|
|
@@ -1211,7 +1254,7 @@ class FlashDeliveryApplicationServiceTest {
|
|
|
assertThrows(ServiceException.class, () -> fixture.service.updateAddress(user, 10L, new FlashDeliveryAddressConfirmRequest()));
|
|
|
assertThrows(ServiceException.class, () -> fixture.service.addTip(user, 10L, tipRequest(5L, 2)));
|
|
|
}
|
|
|
- verify(fixture.routeService, never()).calculate(any(), any());
|
|
|
+ verify(fixture.routeService, never()).calculate(any(), any(), anyInt());
|
|
|
verify(fixture.orderMapper, never()).updateWaitingTip(any(), any());
|
|
|
}
|
|
|
|
|
|
@@ -1255,7 +1298,7 @@ class FlashDeliveryApplicationServiceTest {
|
|
|
input.setDelivery(request().getDelivery());
|
|
|
input.getPickup().setPhone("");
|
|
|
assertThrows(ServiceException.class, () -> fixture.service.quoteAddress(7L, 10L, input));
|
|
|
- when(fixture.routeService.calculate(any(), any())).thenReturn(new RouteDistance(40001, 1000, "GOOGLE"));
|
|
|
+ when(fixture.routeService.calculate(any(), any(), anyInt())).thenReturn(new RouteDistance(40001, 1000, "GOOGLE"));
|
|
|
assertThrows(ServiceException.class, () -> fixture.service.quoteAddress(7L, 10L, addressChange()));
|
|
|
verify(fixture.orderMapper, never()).updateWaitingAddress(any(), any());
|
|
|
}
|
|
|
@@ -1286,8 +1329,8 @@ class FlashDeliveryApplicationServiceTest {
|
|
|
assertThrows(ServiceException.class, () -> fixture.service.addTip(7L, 10L, tipRequest(20L, 2)));
|
|
|
assertEquals(30L, order.getTipAmount());
|
|
|
verify(fixture.orderMapper).updateWaitingTip(any(), eq(2));
|
|
|
- verify(fixture.routeService, never()).calculate(any(), any());
|
|
|
- verify(fixture.pricingMapper, never()).selectAtTime(anyString());
|
|
|
+ verify(fixture.routeService, never()).calculate(any(), any(), anyInt());
|
|
|
+ verify(fixture.pricingMapper, never()).selectAtTime(anyString(), anyInt());
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
@@ -1359,9 +1402,9 @@ class FlashDeliveryApplicationServiceTest {
|
|
|
order.setDistance(new BigDecimal("1.00"));
|
|
|
order.setFreight(15L);
|
|
|
when(fixture.orderMapper.selectById(10L)).thenReturn(order);
|
|
|
- when(fixture.routeService.calculate(any(), any())).thenReturn(new RouteDistance(4500, 900, "GOOGLE"));
|
|
|
+ when(fixture.routeService.calculate(any(), any(), anyInt())).thenReturn(new RouteDistance(4500, 900, "GOOGLE"));
|
|
|
// 031 后改址按订单定价时点读最新运价:stub 与订单快照同值,金额断言维持不变
|
|
|
- when(fixture.pricingMapper.selectAtTime(anyString())).thenReturn(List.of(pricing()));
|
|
|
+ when(fixture.pricingMapper.selectAtTime(anyString(), anyInt())).thenReturn(List.of(pricing()));
|
|
|
return order;
|
|
|
}
|
|
|
|