Class MessageOrderer

java.lang.Object
io.cucumber.compatibilitykit.MessageOrderer

public final class MessageOrderer extends Object
Order Cucumber messages.
  • Field Details

    • random

      private final Random random
      Make test cases deterministically reproducible.
  • Constructor Details

    • MessageOrderer

      public MessageOrderer(Random random)
  • Method Details

    • originalOrder

      public Consumer<List<io.cucumber.messages.types.Envelope>> originalOrder()
    • simulateParallelExecution

      public Consumer<List<io.cucumber.messages.types.Envelope>> simulateParallelExecution()
      Simulates parallel execution of testcases by interleaving the execution of different test cases.

      Cucumber messages only have a partial ordering. By simulating a different ordering implementers of message consumer can test if their consumer works correctly.

    • replaceAll

      private static void replaceAll(List<io.cucumber.messages.types.Envelope> testCaseMessagesInSerial, List<io.cucumber.messages.types.Envelope> envelopes)
    • interleafMessagesFromTestCases

      private static List<io.cucumber.messages.types.Envelope> interleafMessagesFromTestCases(Random random, List<List<io.cucumber.messages.types.Envelope>> messagesGroupedByTestCase)
    • groupTestCasesIntoBuckets

      private static List<List<io.cucumber.messages.types.Envelope>> groupTestCasesIntoBuckets(List<io.cucumber.messages.types.Envelope> testCaseMessages)
    • testCasesSubList

      private static List<io.cucumber.messages.types.Envelope> testCasesSubList(List<io.cucumber.messages.types.Envelope> messages)
    • findTestRunFinishedIndex

      private static int findTestRunFinishedIndex(List<io.cucumber.messages.types.Envelope> messages)
    • findTestRunStartedIndex

      private static int findTestRunStartedIndex(List<io.cucumber.messages.types.Envelope> messages)