|
|
@@ -705,7 +705,6 @@ class FlashDeliveryApplicationServiceTest {
|
|
|
assertEquals(90L, saved.getValue().getStartingFare());
|
|
|
|
|
|
InOrder writeOrder = inOrder(fixture.pricingMapper);
|
|
|
- writeOrder.verify(fixture.pricingMapper).lockPricing();
|
|
|
writeOrder.verify(fixture.pricingMapper)
|
|
|
.countOverlapping("00:00", "24:00", null);
|
|
|
writeOrder.verify(fixture.pricingMapper).insert(any(FlashDeliveryPricing.class));
|
|
|
@@ -739,7 +738,7 @@ class FlashDeliveryApplicationServiceTest {
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- void updatingPricingUsesTheSingleGlobalLock() {
|
|
|
+ void updatingPricingChecksOverlapBeforeVersionedWrite() {
|
|
|
Fixture fixture = new Fixture();
|
|
|
FlashDeliveryPricing existing = pricing();
|
|
|
when(fixture.pricingMapper.selectById(1L)).thenReturn(existing);
|
|
|
@@ -749,10 +748,10 @@ class FlashDeliveryApplicationServiceTest {
|
|
|
|
|
|
fixture.service.updatePricing(9L, 1L, request);
|
|
|
|
|
|
- InOrder lockOrder = inOrder(fixture.pricingMapper);
|
|
|
- lockOrder.verify(fixture.pricingMapper).lockPricing();
|
|
|
- lockOrder.verify(fixture.pricingMapper)
|
|
|
+ InOrder writeOrder = inOrder(fixture.pricingMapper);
|
|
|
+ writeOrder.verify(fixture.pricingMapper)
|
|
|
.countOverlapping("00:00", "24:00", 1L);
|
|
|
+ writeOrder.verify(fixture.pricingMapper).update(isNull(), any(Wrapper.class));
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
@@ -763,11 +762,7 @@ class FlashDeliveryApplicationServiceTest {
|
|
|
|
|
|
fixture.service.deletePricing(18L);
|
|
|
|
|
|
- InOrder deleteOrder = inOrder(fixture.pricingMapper);
|
|
|
- deleteOrder.verify(fixture.pricingMapper).selectById(18L);
|
|
|
- deleteOrder.verify(fixture.pricingMapper).lockPricing();
|
|
|
- deleteOrder.verify(fixture.pricingMapper).selectById(18L);
|
|
|
- deleteOrder.verify(fixture.pricingMapper).deleteById(18L);
|
|
|
+ verify(fixture.pricingMapper).deleteById(18L);
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
@@ -1011,7 +1006,6 @@ class FlashDeliveryApplicationServiceTest {
|
|
|
routeService, new FlashDeliveryPricingCalculator(), lockService, exclusivityService);
|
|
|
|
|
|
Fixture() {
|
|
|
- when(pricingMapper.lockPricing()).thenReturn("GLOBAL");
|
|
|
when(lockService.withLock(any(), any())).thenAnswer(invocation -> {
|
|
|
RiderDeliveryLockService.LockedCall<?> call = invocation.getArgument(1);
|
|
|
return call.call();
|