test_class.file: server/src/test/java/io/spine/server/delivery/LiveDeliveryStationTest.java
test_class.identifier: LiveDeliveryStationTest
test_class.superclass: extends AbstractStationTest
test_case.body: @Test
      @DisplayName("sort messages prior to dispatching")
      void sort() {
          Timestamp now = currentTime();
          Timestamp secondBefore = subtract(now, fromSeconds(1));
          Timestamp twoSecondsBefore = subtract(now, fromSeconds(2));
          Timestamp threeSecondsBefore = subtract(now, fromSeconds(3));
  
          InboxMessage toDeliver1 = toDeliver(targetOne, type, threeSecondsBefore);
          InboxMessage toDeliver2 = toDeliver(targetTwo, type, twoSecondsBefore);
          InboxMessage toDeliver3 = toDeliver(targetOne, type, secondBefore);
          InboxMessage toDeliver4 = toDeliver(targetTwo, type, now);
          Conveyor conveyor = new Conveyor(
                  ImmutableList.of(toDeliver2, toDeliver3, toDeliver4, toDeliver1),
                  new DeliveredMessages()
          );
  
          MemoizingAction action = MemoizingAction.empty();
          Station station = new LiveDeliveryStation(action, noWindow());
          Station.Result result = station.process(conveyor);
          assertDeliveredCount(result, 4);
  
          List<InboxMessage> deliveredMessages = checkNotNull(action.passedMessages());
          assertThat(deliveredMessages).containsExactlyElementsIn(
                  ImmutableList.of(toDeliver1, toDeliver2, toDeliver3, toDeliver4)
          );
      }
test_case.class_method_signature: LiveDeliveryStationTest.sort()
test_case.full_signature: @Test @DisplayName("sort messages prior to dispatching") void sort()
test_case.identifier: sort
test_case.invocations: currentTime subtract fromSeconds subtract fromSeconds subtract fromSeconds toDeliver toDeliver toDeliver toDeliver of empty noWindow process assertDeliveredCount checkNotNull passedMessages containsExactlyElementsIn assertThat of
test_case.modifiers: @Test @DisplayName("sort messages prior to dispatching")
test_case.parameters: ()
test_case.return: void
test_case.signature: void sort()
focal_class.declarator: action
focal_class.modifier: private final
focal_class.original_string: private final DeliveryAction action;
focal_class.type: DeliveryAction
focal_class.var_name: action
focal_class.declarator: deduplicationWindow
focal_class.modifier: private final @Nullable
focal_class.original_string: private final @Nullable Duration deduplicationWindow;
focal_class.type: Duration
focal_class.var_name: deduplicationWindow
focal_class.file: server/src/main/java/io/spine/server/delivery/LiveDeliveryStation.java
focal_class.identifier: LiveDeliveryStation
focal_class.class_method_signature: LiveDeliveryStation.LiveDeliveryStation(DeliveryAction action, Duration deduplicationWindow)
focal_class.full_signature:   LiveDeliveryStation(DeliveryAction action, Duration deduplicationWindow)
focal_class.identifier: LiveDeliveryStation
focal_class.parameters: (DeliveryAction action, Duration deduplicationWindow)
focal_class.signature:  LiveDeliveryStation(DeliveryAction action, Duration deduplicationWindow)
focal_class.class_method_signature: LiveDeliveryStation.process(Conveyor conveyor)
focal_class.full_signature: @Override public final Result process(Conveyor conveyor)
focal_class.identifier: process
focal_class.modifiers: @Override public final
focal_class.parameters: (Conveyor conveyor)
focal_class.return: Result
focal_class.signature: Result process(Conveyor conveyor)
focal_class.class_method_signature: LiveDeliveryStation.deduplicateAndSort(Collection<InboxMessage> messages,
                                                           Conveyor conveyor)
focal_class.full_signature: private static List<InboxMessage> deduplicateAndSort(Collection<InboxMessage> messages,
                                                           Conveyor conveyor)
focal_class.identifier: deduplicateAndSort
focal_class.modifiers: private static
focal_class.parameters: (Collection<InboxMessage> messages,
                                                           Conveyor conveyor)
focal_class.return: List<InboxMessage>
focal_class.signature: List<InboxMessage> deduplicateAndSort(Collection<InboxMessage> messages,
                                                           Conveyor conveyor)
focal_class.superclass: extends Station
focal_method.body: @Override
      public final Result process(Conveyor conveyor) {
          FilterToDeliver filter = new FilterToDeliver(conveyor);
          Collection<InboxMessage> filtered = filter.messagesToDispatch();
          if (filtered.isEmpty()) {
              return emptyResult();
          }
          List<InboxMessage> toDispatch = deduplicateAndSort(filtered, conveyor);
          DeliveryErrors errors = action.executeFor(toDispatch);
          conveyor.markDelivered(toDispatch);
          Result result = new Result(toDispatch.size(), errors);
          return result;
      }
focal_method.class_method_signature: LiveDeliveryStation.process(Conveyor conveyor)
focal_method.full_signature: @Override public final Result process(Conveyor conveyor)
focal_method.identifier: process
focal_method.invocations: messagesToDispatch isEmpty emptyResult deduplicateAndSort executeFor markDelivered size
focal_method.modifiers: @Override public final
focal_method.parameters: (Conveyor conveyor)
focal_method.return: Result
focal_method.signature: Result process(Conveyor conveyor)