Class TestCase.Builder

java.lang.Object
com.google.protobuf.AbstractMessageLite.Builder
com.google.protobuf.AbstractMessage.Builder<BuilderT>
com.google.protobuf.GeneratedMessageV3.Builder<TestCase.Builder>
dev.cel.expr.conformance.test.TestCase.Builder
All Implemented Interfaces:
com.google.protobuf.Message.Builder, com.google.protobuf.MessageLite.Builder, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, TestCaseOrBuilder, Cloneable
Enclosing class:
TestCase

public static final class TestCase.Builder extends com.google.protobuf.GeneratedMessageV3.Builder<TestCase.Builder> implements TestCaseOrBuilder
 A test to validate a CEL policy or expression. The test case encompasses
 evaluation of the compiled expression using the provided input bindings and
 asserting the result against the expected result.
 It can also validate a raw CEL expression string through parse, check and
 eval stages, making use of the augmenting CEL environment if provided.
 
Protobuf type cel.expr.conformance.test.TestCase
  • Method Details

    • getDescriptor

      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
    • internalGetMapFieldReflection

      protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection(int number)
      Overrides:
      internalGetMapFieldReflection in class com.google.protobuf.GeneratedMessageV3.Builder<TestCase.Builder>
    • internalGetMutableMapFieldReflection

      protected com.google.protobuf.MapFieldReflectionAccessor internalGetMutableMapFieldReflection(int number)
      Overrides:
      internalGetMutableMapFieldReflection in class com.google.protobuf.GeneratedMessageV3.Builder<TestCase.Builder>
    • internalGetFieldAccessorTable

      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
      Specified by:
      internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3.Builder<TestCase.Builder>
    • clear

      public TestCase.Builder clear()
      Specified by:
      clear in interface com.google.protobuf.Message.Builder
      Specified by:
      clear in interface com.google.protobuf.MessageLite.Builder
      Overrides:
      clear in class com.google.protobuf.GeneratedMessageV3.Builder<TestCase.Builder>
    • getDescriptorForType

      public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()
      Specified by:
      getDescriptorForType in interface com.google.protobuf.Message.Builder
      Specified by:
      getDescriptorForType in interface com.google.protobuf.MessageOrBuilder
      Overrides:
      getDescriptorForType in class com.google.protobuf.GeneratedMessageV3.Builder<TestCase.Builder>
    • getDefaultInstanceForType

      public TestCase getDefaultInstanceForType()
      Specified by:
      getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
      Specified by:
      getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder
    • build

      public TestCase build()
      Specified by:
      build in interface com.google.protobuf.Message.Builder
      Specified by:
      build in interface com.google.protobuf.MessageLite.Builder
    • buildPartial

      public TestCase buildPartial()
      Specified by:
      buildPartial in interface com.google.protobuf.Message.Builder
      Specified by:
      buildPartial in interface com.google.protobuf.MessageLite.Builder
    • clone

      public TestCase.Builder clone()
      Specified by:
      clone in interface com.google.protobuf.Message.Builder
      Specified by:
      clone in interface com.google.protobuf.MessageLite.Builder
      Overrides:
      clone in class com.google.protobuf.GeneratedMessageV3.Builder<TestCase.Builder>
    • setField

      public TestCase.Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)
      Specified by:
      setField in interface com.google.protobuf.Message.Builder
      Overrides:
      setField in class com.google.protobuf.GeneratedMessageV3.Builder<TestCase.Builder>
    • clearField

      public TestCase.Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field)
      Specified by:
      clearField in interface com.google.protobuf.Message.Builder
      Overrides:
      clearField in class com.google.protobuf.GeneratedMessageV3.Builder<TestCase.Builder>
    • clearOneof

      public TestCase.Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)
      Specified by:
      clearOneof in interface com.google.protobuf.Message.Builder
      Overrides:
      clearOneof in class com.google.protobuf.GeneratedMessageV3.Builder<TestCase.Builder>
    • setRepeatedField

      public TestCase.Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value)
      Specified by:
      setRepeatedField in interface com.google.protobuf.Message.Builder
      Overrides:
      setRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<TestCase.Builder>
    • addRepeatedField

      public TestCase.Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)
      Specified by:
      addRepeatedField in interface com.google.protobuf.Message.Builder
      Overrides:
      addRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<TestCase.Builder>
    • mergeFrom

      public TestCase.Builder mergeFrom(com.google.protobuf.Message other)
      Specified by:
      mergeFrom in interface com.google.protobuf.Message.Builder
      Overrides:
      mergeFrom in class com.google.protobuf.AbstractMessage.Builder<TestCase.Builder>
    • mergeFrom

      public TestCase.Builder mergeFrom(TestCase other)
    • isInitialized

      public final boolean isInitialized()
      Specified by:
      isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
      Overrides:
      isInitialized in class com.google.protobuf.GeneratedMessageV3.Builder<TestCase.Builder>
    • mergeFrom

      public TestCase.Builder mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
      Specified by:
      mergeFrom in interface com.google.protobuf.Message.Builder
      Specified by:
      mergeFrom in interface com.google.protobuf.MessageLite.Builder
      Overrides:
      mergeFrom in class com.google.protobuf.AbstractMessage.Builder<TestCase.Builder>
      Throws:
      IOException
    • getName

      public String getName()
       Name of the test case.
       
      string name = 1;
      Specified by:
      getName in interface TestCaseOrBuilder
      Returns:
      The name.
    • getNameBytes

      public com.google.protobuf.ByteString getNameBytes()
       Name of the test case.
       
      string name = 1;
      Specified by:
      getNameBytes in interface TestCaseOrBuilder
      Returns:
      The bytes for name.
    • setName

      public TestCase.Builder setName(String value)
       Name of the test case.
       
      string name = 1;
      Parameters:
      value - The name to set.
      Returns:
      This builder for chaining.
    • clearName

      public TestCase.Builder clearName()
       Name of the test case.
       
      string name = 1;
      Returns:
      This builder for chaining.
    • setNameBytes

      public TestCase.Builder setNameBytes(com.google.protobuf.ByteString value)
       Name of the test case.
       
      string name = 1;
      Parameters:
      value - The bytes for name to set.
      Returns:
      This builder for chaining.
    • getDescription

      public String getDescription()
       A description of the test.
       
      string description = 2;
      Specified by:
      getDescription in interface TestCaseOrBuilder
      Returns:
      The description.
    • getDescriptionBytes

      public com.google.protobuf.ByteString getDescriptionBytes()
       A description of the test.
       
      string description = 2;
      Specified by:
      getDescriptionBytes in interface TestCaseOrBuilder
      Returns:
      The bytes for description.
    • setDescription

      public TestCase.Builder setDescription(String value)
       A description of the test.
       
      string description = 2;
      Parameters:
      value - The description to set.
      Returns:
      This builder for chaining.
    • clearDescription

      public TestCase.Builder clearDescription()
       A description of the test.
       
      string description = 2;
      Returns:
      This builder for chaining.
    • setDescriptionBytes

      public TestCase.Builder setDescriptionBytes(com.google.protobuf.ByteString value)
       A description of the test.
       
      string description = 2;
      Parameters:
      value - The bytes for description to set.
      Returns:
      This builder for chaining.
    • getExpr

      public String getExpr()
       The text of the CEL expression.
       
      string expr = 3;
      Specified by:
      getExpr in interface TestCaseOrBuilder
      Returns:
      The expr.
    • getExprBytes

      public com.google.protobuf.ByteString getExprBytes()
       The text of the CEL expression.
       
      string expr = 3;
      Specified by:
      getExprBytes in interface TestCaseOrBuilder
      Returns:
      The bytes for expr.
    • setExpr

      public TestCase.Builder setExpr(String value)
       The text of the CEL expression.
       
      string expr = 3;
      Parameters:
      value - The expr to set.
      Returns:
      This builder for chaining.
    • clearExpr

      public TestCase.Builder clearExpr()
       The text of the CEL expression.
       
      string expr = 3;
      Returns:
      This builder for chaining.
    • setExprBytes

      public TestCase.Builder setExprBytes(com.google.protobuf.ByteString value)
       The text of the CEL expression.
       
      string expr = 3;
      Parameters:
      value - The bytes for expr to set.
      Returns:
      This builder for chaining.
    • hasEnv

      public boolean hasEnv()
       Serialized environment to be used for compilation and evaluation of the
       CEL expression for the current test case.
       This option allows validating the same expression against multiple
       environments.
       
      .cel.expr.conformance.Environment env = 4;
      Specified by:
      hasEnv in interface TestCaseOrBuilder
      Returns:
      Whether the env field is set.
    • getEnv

      public Environment getEnv()
       Serialized environment to be used for compilation and evaluation of the
       CEL expression for the current test case.
       This option allows validating the same expression against multiple
       environments.
       
      .cel.expr.conformance.Environment env = 4;
      Specified by:
      getEnv in interface TestCaseOrBuilder
      Returns:
      The env.
    • setEnv

      public TestCase.Builder setEnv(Environment value)
       Serialized environment to be used for compilation and evaluation of the
       CEL expression for the current test case.
       This option allows validating the same expression against multiple
       environments.
       
      .cel.expr.conformance.Environment env = 4;
    • setEnv

      public TestCase.Builder setEnv(Environment.Builder builderForValue)
       Serialized environment to be used for compilation and evaluation of the
       CEL expression for the current test case.
       This option allows validating the same expression against multiple
       environments.
       
      .cel.expr.conformance.Environment env = 4;
    • mergeEnv

      public TestCase.Builder mergeEnv(Environment value)
       Serialized environment to be used for compilation and evaluation of the
       CEL expression for the current test case.
       This option allows validating the same expression against multiple
       environments.
       
      .cel.expr.conformance.Environment env = 4;
    • clearEnv

      public TestCase.Builder clearEnv()
       Serialized environment to be used for compilation and evaluation of the
       CEL expression for the current test case.
       This option allows validating the same expression against multiple
       environments.
       
      .cel.expr.conformance.Environment env = 4;
    • getEnvBuilder

      public Environment.Builder getEnvBuilder()
       Serialized environment to be used for compilation and evaluation of the
       CEL expression for the current test case.
       This option allows validating the same expression against multiple
       environments.
       
      .cel.expr.conformance.Environment env = 4;
    • getEnvOrBuilder

      public EnvironmentOrBuilder getEnvOrBuilder()
       Serialized environment to be used for compilation and evaluation of the
       CEL expression for the current test case.
       This option allows validating the same expression against multiple
       environments.
       
      .cel.expr.conformance.Environment env = 4;
      Specified by:
      getEnvOrBuilder in interface TestCaseOrBuilder
    • getInputCount

      public int getInputCount()
      Description copied from interface: TestCaseOrBuilder
       A map representing a variable binding where the key is the name of the
       input variable.
       
      map<string, .cel.expr.conformance.test.InputValue> input = 5;
      Specified by:
      getInputCount in interface TestCaseOrBuilder
    • containsInput

      public boolean containsInput(String key)
       A map representing a variable binding where the key is the name of the
       input variable.
       
      map<string, .cel.expr.conformance.test.InputValue> input = 5;
      Specified by:
      containsInput in interface TestCaseOrBuilder
    • getInput

      @Deprecated public Map<String,InputValue> getInput()
      Deprecated.
      Use getInputMap() instead.
      Specified by:
      getInput in interface TestCaseOrBuilder
    • getInputMap

      public Map<String,InputValue> getInputMap()
       A map representing a variable binding where the key is the name of the
       input variable.
       
      map<string, .cel.expr.conformance.test.InputValue> input = 5;
      Specified by:
      getInputMap in interface TestCaseOrBuilder
    • getInputOrDefault

      public InputValue getInputOrDefault(String key, InputValue defaultValue)
       A map representing a variable binding where the key is the name of the
       input variable.
       
      map<string, .cel.expr.conformance.test.InputValue> input = 5;
      Specified by:
      getInputOrDefault in interface TestCaseOrBuilder
    • getInputOrThrow

      public InputValue getInputOrThrow(String key)
       A map representing a variable binding where the key is the name of the
       input variable.
       
      map<string, .cel.expr.conformance.test.InputValue> input = 5;
      Specified by:
      getInputOrThrow in interface TestCaseOrBuilder
    • clearInput

      public TestCase.Builder clearInput()
    • removeInput

      public TestCase.Builder removeInput(String key)
       A map representing a variable binding where the key is the name of the
       input variable.
       
      map<string, .cel.expr.conformance.test.InputValue> input = 5;
    • getMutableInput

      @Deprecated public Map<String,InputValue> getMutableInput()
      Deprecated.
      Use alternate mutation accessors instead.
    • putInput

      public TestCase.Builder putInput(String key, InputValue value)
       A map representing a variable binding where the key is the name of the
       input variable.
       
      map<string, .cel.expr.conformance.test.InputValue> input = 5;
    • putAllInput

      public TestCase.Builder putAllInput(Map<String,InputValue> values)
       A map representing a variable binding where the key is the name of the
       input variable.
       
      map<string, .cel.expr.conformance.test.InputValue> input = 5;
    • putInputBuilderIfAbsent

      public InputValue.Builder putInputBuilderIfAbsent(String key)
       A map representing a variable binding where the key is the name of the
       input variable.
       
      map<string, .cel.expr.conformance.test.InputValue> input = 5;
    • hasInputContext

      public boolean hasInputContext()
       Input in the form of a context proto for the test case.
       Note: Only one of `input_bindings` and `input_context` can be provided. Providing
       both should result in an error.
       
      .cel.expr.conformance.test.InputContext input_context = 6;
      Specified by:
      hasInputContext in interface TestCaseOrBuilder
      Returns:
      Whether the inputContext field is set.
    • getInputContext

      public InputContext getInputContext()
       Input in the form of a context proto for the test case.
       Note: Only one of `input_bindings` and `input_context` can be provided. Providing
       both should result in an error.
       
      .cel.expr.conformance.test.InputContext input_context = 6;
      Specified by:
      getInputContext in interface TestCaseOrBuilder
      Returns:
      The inputContext.
    • setInputContext

      public TestCase.Builder setInputContext(InputContext value)
       Input in the form of a context proto for the test case.
       Note: Only one of `input_bindings` and `input_context` can be provided. Providing
       both should result in an error.
       
      .cel.expr.conformance.test.InputContext input_context = 6;
    • setInputContext

      public TestCase.Builder setInputContext(InputContext.Builder builderForValue)
       Input in the form of a context proto for the test case.
       Note: Only one of `input_bindings` and `input_context` can be provided. Providing
       both should result in an error.
       
      .cel.expr.conformance.test.InputContext input_context = 6;
    • mergeInputContext

      public TestCase.Builder mergeInputContext(InputContext value)
       Input in the form of a context proto for the test case.
       Note: Only one of `input_bindings` and `input_context` can be provided. Providing
       both should result in an error.
       
      .cel.expr.conformance.test.InputContext input_context = 6;
    • clearInputContext

      public TestCase.Builder clearInputContext()
       Input in the form of a context proto for the test case.
       Note: Only one of `input_bindings` and `input_context` can be provided. Providing
       both should result in an error.
       
      .cel.expr.conformance.test.InputContext input_context = 6;
    • getInputContextBuilder

      public InputContext.Builder getInputContextBuilder()
       Input in the form of a context proto for the test case.
       Note: Only one of `input_bindings` and `input_context` can be provided. Providing
       both should result in an error.
       
      .cel.expr.conformance.test.InputContext input_context = 6;
    • getInputContextOrBuilder

      public InputContextOrBuilder getInputContextOrBuilder()
       Input in the form of a context proto for the test case.
       Note: Only one of `input_bindings` and `input_context` can be provided. Providing
       both should result in an error.
       
      .cel.expr.conformance.test.InputContext input_context = 6;
      Specified by:
      getInputContextOrBuilder in interface TestCaseOrBuilder
    • hasOutput

      public boolean hasOutput()
       Expected result of the test case.
       
      .cel.expr.conformance.test.TestOutput output = 7;
      Specified by:
      hasOutput in interface TestCaseOrBuilder
      Returns:
      Whether the output field is set.
    • getOutput

      public TestOutput getOutput()
       Expected result of the test case.
       
      .cel.expr.conformance.test.TestOutput output = 7;
      Specified by:
      getOutput in interface TestCaseOrBuilder
      Returns:
      The output.
    • setOutput

      public TestCase.Builder setOutput(TestOutput value)
       Expected result of the test case.
       
      .cel.expr.conformance.test.TestOutput output = 7;
    • setOutput

      public TestCase.Builder setOutput(TestOutput.Builder builderForValue)
       Expected result of the test case.
       
      .cel.expr.conformance.test.TestOutput output = 7;
    • mergeOutput

      public TestCase.Builder mergeOutput(TestOutput value)
       Expected result of the test case.
       
      .cel.expr.conformance.test.TestOutput output = 7;
    • clearOutput

      public TestCase.Builder clearOutput()
       Expected result of the test case.
       
      .cel.expr.conformance.test.TestOutput output = 7;
    • getOutputBuilder

      public TestOutput.Builder getOutputBuilder()
       Expected result of the test case.
       
      .cel.expr.conformance.test.TestOutput output = 7;
    • getOutputOrBuilder

      public TestOutputOrBuilder getOutputOrBuilder()
       Expected result of the test case.
       
      .cel.expr.conformance.test.TestOutput output = 7;
      Specified by:
      getOutputOrBuilder in interface TestCaseOrBuilder
    • hasDeducedType

      public boolean hasDeducedType()
       If specified validates that the deduced type at check time matches
       If the result kind is not set and this field is set, the test is considered
       "check-only".
       
      .cel.expr.Type deduced_type = 8;
      Specified by:
      hasDeducedType in interface TestCaseOrBuilder
      Returns:
      Whether the deducedType field is set.
    • getDeducedType

      public Type getDeducedType()
       If specified validates that the deduced type at check time matches
       If the result kind is not set and this field is set, the test is considered
       "check-only".
       
      .cel.expr.Type deduced_type = 8;
      Specified by:
      getDeducedType in interface TestCaseOrBuilder
      Returns:
      The deducedType.
    • setDeducedType

      public TestCase.Builder setDeducedType(Type value)
       If specified validates that the deduced type at check time matches
       If the result kind is not set and this field is set, the test is considered
       "check-only".
       
      .cel.expr.Type deduced_type = 8;
    • setDeducedType

      public TestCase.Builder setDeducedType(Type.Builder builderForValue)
       If specified validates that the deduced type at check time matches
       If the result kind is not set and this field is set, the test is considered
       "check-only".
       
      .cel.expr.Type deduced_type = 8;
    • mergeDeducedType

      public TestCase.Builder mergeDeducedType(Type value)
       If specified validates that the deduced type at check time matches
       If the result kind is not set and this field is set, the test is considered
       "check-only".
       
      .cel.expr.Type deduced_type = 8;
    • clearDeducedType

      public TestCase.Builder clearDeducedType()
       If specified validates that the deduced type at check time matches
       If the result kind is not set and this field is set, the test is considered
       "check-only".
       
      .cel.expr.Type deduced_type = 8;
    • getDeducedTypeBuilder

      public Type.Builder getDeducedTypeBuilder()
       If specified validates that the deduced type at check time matches
       If the result kind is not set and this field is set, the test is considered
       "check-only".
       
      .cel.expr.Type deduced_type = 8;
    • getDeducedTypeOrBuilder

      public TypeOrBuilder getDeducedTypeOrBuilder()
       If specified validates that the deduced type at check time matches
       If the result kind is not set and this field is set, the test is considered
       "check-only".
       
      .cel.expr.Type deduced_type = 8;
      Specified by:
      getDeducedTypeOrBuilder in interface TestCaseOrBuilder
    • getDisableCheck

      public boolean getDisableCheck()
       Bypass the type-checking and only attempt to evaluate the parsed
       expression.
       
      bool disable_check = 9;
      Specified by:
      getDisableCheck in interface TestCaseOrBuilder
      Returns:
      The disableCheck.
    • setDisableCheck

      public TestCase.Builder setDisableCheck(boolean value)
       Bypass the type-checking and only attempt to evaluate the parsed
       expression.
       
      bool disable_check = 9;
      Parameters:
      value - The disableCheck to set.
      Returns:
      This builder for chaining.
    • clearDisableCheck

      public TestCase.Builder clearDisableCheck()
       Bypass the type-checking and only attempt to evaluate the parsed
       expression.
       
      bool disable_check = 9;
      Returns:
      This builder for chaining.
    • setUnknownFields

      public final TestCase.Builder setUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)
      Specified by:
      setUnknownFields in interface com.google.protobuf.Message.Builder
      Overrides:
      setUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<TestCase.Builder>
    • mergeUnknownFields

      public final TestCase.Builder mergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)
      Specified by:
      mergeUnknownFields in interface com.google.protobuf.Message.Builder
      Overrides:
      mergeUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<TestCase.Builder>