Class SelectorBuilder

  • All Implemented Interfaces:

    
    public class SelectorBuilder
    
                        

    Builder for setting up consumer version selectors in provider JUnit tests. See https://docs.pact.io/pact_broker/advanced_topics/consumer_version_selectors

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private final List<ConsumerVersionSelectors> selectors
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Constructor Detail

      • SelectorBuilder

        SelectorBuilder()
    • Method Detail

      • mainBranch

         final SelectorBuilder mainBranch()

        The latest version from the main branch of each consumer, as specified by the consumer's mainBranch property.

      • branch

        @JvmOverloads() final SelectorBuilder branch(String name, String consumer, String fallback)

        The latest version from a particular branch of each consumer, or for a particular consumer if the second parameter is provided. If fallback is provided, falling back to the fallback branch if none is found from the specified branch.

        Parameters:
        name -
        • Branch name

        consumer -
        • Consumer name (optional)

        fallback -
        • Fall back to this branch if none is found from the specified branch (optional)

      • branch

        @JvmOverloads() final SelectorBuilder branch(String name, String consumer)

        The latest version from a particular branch of each consumer, or for a particular consumer if the second parameter is provided. If fallback is provided, falling back to the fallback branch if none is found from the specified branch.

        Parameters:
        name -
        • Branch name

        consumer -
        • Consumer name (optional)

      • branch

        @JvmOverloads() final SelectorBuilder branch(String name)

        The latest version from a particular branch of each consumer, or for a particular consumer if the second parameter is provided. If fallback is provided, falling back to the fallback branch if none is found from the specified branch.

        Parameters:
        name -
        • Branch name

      • matchingBranch

         final SelectorBuilder matchingBranch()

        The latest version from any branch of the consumer that has the same name as the current branch of the provider. Used for coordinated development between consumer and provider teams using matching feature branch names.

      • selector

        @Deprecated(message = "Tags are deprecated in favor of branches", replaceWith = @ReplaceWith(imports = {}, expression = "branch")) final SelectorBuilder selector(String tagName, Boolean latest, String fallbackTag, String consumer)

        Generic selector.

        • With just the tag name, returns all versions with the specified tag.

        • With latest, returns the latest version for each consumer with the specified tag.

        • With a fallback tag, returns the latest version for each consumer with the specified tag, falling back to the fallbackTag if non is found with the specified tag.

        • With a consumer name, returns the latest version for a specified consumer with the specified tag.

        • With only latest, returns the latest version for each consumer. NOT RECOMMENDED as it suffers from race conditions when pacts are published from multiple branches.

      • build

         final List<ConsumerVersionSelectors> build()

        Construct the final list of consumer version selectors