Class TestCase

java.lang.Object
com.google.protobuf.AbstractMessageLite
com.google.protobuf.AbstractMessage
com.google.protobuf.GeneratedMessageV3
dev.cel.expr.conformance.test.TestCase
All Implemented Interfaces:
com.google.protobuf.Message, com.google.protobuf.MessageLite, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, TestCaseOrBuilder, Serializable

public final class TestCase extends com.google.protobuf.GeneratedMessageV3 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
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    A test to validate a CEL policy or expression.

    Nested classes/interfaces inherited from class com.google.protobuf.GeneratedMessageV3

    com.google.protobuf.GeneratedMessageV3.BuilderParent, com.google.protobuf.GeneratedMessageV3.ExtendableBuilder<MessageT extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage<MessageT>,BuilderT extends com.google.protobuf.GeneratedMessageV3.ExtendableBuilder<MessageT,BuilderT>>, com.google.protobuf.GeneratedMessageV3.ExtendableMessage<MessageT extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage<MessageT>>, com.google.protobuf.GeneratedMessageV3.ExtendableMessageOrBuilder<MessageT extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage<MessageT>>, com.google.protobuf.GeneratedMessageV3.FieldAccessorTable, com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter

    Nested classes/interfaces inherited from class com.google.protobuf.AbstractMessageLite

    com.google.protobuf.AbstractMessageLite.InternalOneOfEnum
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     

    Fields inherited from class com.google.protobuf.GeneratedMessageV3

    alwaysUseFieldBuilders, unknownFields

    Fields inherited from class com.google.protobuf.AbstractMessage

    memoizedSize

    Fields inherited from class com.google.protobuf.AbstractMessageLite

    memoizedHashCode
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    A map representing a variable binding where the key is the name of the input variable.
    boolean
     
    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".
    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".
    static TestCase
     
     
    A description of the test.
    com.google.protobuf.ByteString
    A description of the test.
    static final com.google.protobuf.Descriptors.Descriptor
     
    boolean
    Bypass the type-checking and only attempt to evaluate the parsed expression.
    Serialized environment to be used for compilation and evaluation of the CEL expression for the current test case.
    Serialized environment to be used for compilation and evaluation of the CEL expression for the current test case.
    The text of the CEL expression.
    com.google.protobuf.ByteString
    The text of the CEL expression.
    Deprecated.
    Input in the form of a context proto for the test case.
    Input in the form of a context proto for the test case.
    int
    A map representing a variable binding where the key is the name of the input variable.
    A map representing a variable binding where the key is the name of the input variable.
    getInputOrDefault(String key, InputValue defaultValue)
    A map representing a variable binding where the key is the name of the input variable.
    A map representing a variable binding where the key is the name of the input variable.
    Name of the test case.
    com.google.protobuf.ByteString
    Name of the test case.
    Expected result of the test case.
    Expected result of the test case.
    com.google.protobuf.Parser<TestCase>
     
    int
     
    boolean
    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".
    boolean
    Serialized environment to be used for compilation and evaluation of the CEL expression for the current test case.
    int
     
    boolean
    Input in the form of a context proto for the test case.
    boolean
    Expected result of the test case.
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
     
    protected com.google.protobuf.MapFieldReflectionAccessor
     
    final boolean
     
     
    newBuilder(TestCase prototype)
     
     
    newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)
     
    protected Object
    newInstance(com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter unused)
     
    static TestCase
     
    static TestCase
    parseDelimitedFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
     
    static TestCase
    parseFrom(byte[] data)
     
    static TestCase
    parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
     
    static TestCase
    parseFrom(com.google.protobuf.ByteString data)
     
    static TestCase
    parseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
     
    static TestCase
    parseFrom(com.google.protobuf.CodedInputStream input)
     
    static TestCase
    parseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
     
    static TestCase
     
    static TestCase
    parseFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
     
    static TestCase
     
    static TestCase
    parseFrom(ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
     
    static com.google.protobuf.Parser<TestCase>
     
     
    void
    writeTo(com.google.protobuf.CodedOutputStream output)
     

    Methods inherited from class com.google.protobuf.GeneratedMessageV3

    canUseUnsafe, computeStringSize, computeStringSizeNoTag, emptyBooleanList, emptyDoubleList, emptyFloatList, emptyIntList, emptyList, emptyLongList, getAllFields, getDescriptorForType, getField, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof, internalGetMapField, isStringEmpty, makeExtensionsImmutable, makeMutableCopy, makeMutableCopy, mergeFromAndMakeImmutableInternal, mutableCopy, mutableCopy, mutableCopy, mutableCopy, mutableCopy, newBooleanList, newBuilderForType, newDoubleList, newFloatList, newIntList, newLongList, parseDelimitedWithIOException, parseDelimitedWithIOException, parseUnknownField, parseUnknownFieldProto3, parseWithIOException, parseWithIOException, parseWithIOException, parseWithIOException, serializeBooleanMapTo, serializeIntegerMapTo, serializeLongMapTo, serializeStringMapTo, writeReplace, writeString, writeStringNoTag

    Methods inherited from class com.google.protobuf.AbstractMessage

    findInitializationErrors, getInitializationErrorString, hashBoolean, hashEnum, hashEnumList, hashFields, hashLong, toString

    Methods inherited from class com.google.protobuf.AbstractMessageLite

    addAll, addAll, checkByteStringIsUtf8, toByteArray, toByteString, writeDelimitedTo, writeTo

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface com.google.protobuf.MessageLite

    toByteArray, toByteString, writeDelimitedTo, writeTo

    Methods inherited from interface com.google.protobuf.MessageOrBuilder

    findInitializationErrors, getAllFields, getDescriptorForType, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof
  • Field Details

  • Method Details

    • newInstance

      protected Object newInstance(com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter unused)
      Overrides:
      newInstance in class com.google.protobuf.GeneratedMessageV3
    • 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
    • internalGetFieldAccessorTable

      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
      Specified by:
      internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3
    • 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.
    • 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.
    • 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.
    • 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.
    • 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
    • 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.
    • 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.
    • 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.
    • 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.
    • isInitialized

      public final boolean isInitialized()
      Specified by:
      isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
      Overrides:
      isInitialized in class com.google.protobuf.GeneratedMessageV3
    • writeTo

      public void writeTo(com.google.protobuf.CodedOutputStream output) throws IOException
      Specified by:
      writeTo in interface com.google.protobuf.MessageLite
      Overrides:
      writeTo in class com.google.protobuf.GeneratedMessageV3
      Throws:
      IOException
    • getSerializedSize

      public int getSerializedSize()
      Specified by:
      getSerializedSize in interface com.google.protobuf.MessageLite
      Overrides:
      getSerializedSize in class com.google.protobuf.GeneratedMessageV3
    • equals

      public boolean equals(Object obj)
      Specified by:
      equals in interface com.google.protobuf.Message
      Overrides:
      equals in class com.google.protobuf.AbstractMessage
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface com.google.protobuf.Message
      Overrides:
      hashCode in class com.google.protobuf.AbstractMessage
    • parseFrom

      public static TestCase parseFrom(ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static TestCase parseFrom(ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static TestCase parseFrom(com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static TestCase parseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static TestCase parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static TestCase parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static TestCase parseFrom(InputStream input) throws IOException
      Throws:
      IOException
    • parseFrom

      public static TestCase parseFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
      Throws:
      IOException
    • parseDelimitedFrom

      public static TestCase parseDelimitedFrom(InputStream input) throws IOException
      Throws:
      IOException
    • parseDelimitedFrom

      public static TestCase parseDelimitedFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
      Throws:
      IOException
    • parseFrom

      public static TestCase parseFrom(com.google.protobuf.CodedInputStream input) throws IOException
      Throws:
      IOException
    • parseFrom

      public static TestCase parseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
      Throws:
      IOException
    • newBuilderForType

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

      public static TestCase.Builder newBuilder()
    • newBuilder

      public static TestCase.Builder newBuilder(TestCase prototype)
    • toBuilder

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

      protected TestCase.Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)
      Specified by:
      newBuilderForType in class com.google.protobuf.GeneratedMessageV3
    • getDefaultInstance

      public static TestCase getDefaultInstance()
    • parser

      public static com.google.protobuf.Parser<TestCase> parser()
    • getParserForType

      public com.google.protobuf.Parser<TestCase> getParserForType()
      Specified by:
      getParserForType in interface com.google.protobuf.Message
      Specified by:
      getParserForType in interface com.google.protobuf.MessageLite
      Overrides:
      getParserForType in class com.google.protobuf.GeneratedMessageV3
    • getDefaultInstanceForType

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