Class TestData.FlagBuilder.FlagRuleBuilder

    • Constructor Detail

      • FlagRuleBuilder

        public FlagRuleBuilder()
    • Method Detail

      • andMatch

        public TestData.FlagBuilder.FlagRuleBuilder andMatch​(UserAttribute attribute,
                                                             LDValue... values)
        Adds another clause, using the "is one of" operator.

        For example, this creates a rule that returns true if the name is "Patsy" and the country is "gb":

        
             testData.flag("flag")
                 .ifMatch(UserAttribute.NAME, LDValue.of("Patsy"))
                 .andMatch(UserAttribute.COUNTRY, LDValue.of("gb"))
                 .thenReturn(true));
         
        Parameters:
        attribute - the user attribute to match against
        values - values to compare to
        Returns:
        the rule builder
      • andNotMatch

        public TestData.FlagBuilder.FlagRuleBuilder andNotMatch​(UserAttribute attribute,
                                                                LDValue... values)
        Adds another clause, using the "is not one of" operator.

        For example, this creates a rule that returns true if the name is "Patsy" and the country is not "gb":

        
             testData.flag("flag")
                 .ifMatch(UserAttribute.NAME, LDValue.of("Patsy"))
                 .andNotMatch(UserAttribute.COUNTRY, LDValue.of("gb"))
                 .thenReturn(true));
         
        Parameters:
        attribute - the user attribute to match against
        values - values to compare to
        Returns:
        the rule builder
      • thenReturn

        public TestData.FlagBuilder thenReturn​(boolean variation)
        Finishes defining the rule, specifying the result value as a boolean.
        Parameters:
        variation - the value to return if the rule matches the user
        Returns:
        the flag builder
      • thenReturn

        public TestData.FlagBuilder thenReturn​(int variationIndex)
        Finishes defining the rule, specifying the result as a variation index.
        Parameters:
        variationIndex - the variation to return if the rule matches the user: 0 for the first, 1 for the second, etc.
        Returns:
        the flag builder