Package dev.cel.expr.conformance.test
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 ClassesModifier and TypeClassDescriptionstatic final classA 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
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intFields inherited from class com.google.protobuf.GeneratedMessageV3
alwaysUseFieldBuilders, unknownFieldsFields inherited from class com.google.protobuf.AbstractMessage
memoizedSizeFields inherited from class com.google.protobuf.AbstractMessageLite
memoizedHashCode -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsInput(String key) A map representing a variable binding where the key is the name of the input variable.booleanIf 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 TestCaseA description of the test.com.google.protobuf.ByteStringA description of the test.static final com.google.protobuf.Descriptors.DescriptorbooleanBypass the type-checking and only attempt to evaluate the parsed expression.getEnv()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.getExpr()The text of the CEL expression.com.google.protobuf.ByteStringThe text of the CEL expression.getInput()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.intA 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.getInputOrThrow(String key) A map representing a variable binding where the key is the name of the input variable.getName()Name of the test case.com.google.protobuf.ByteStringName of the test case.Expected result of the test case.Expected result of the test case.com.google.protobuf.Parser<TestCase>intbooleanIf 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".booleanhasEnv()Serialized environment to be used for compilation and evaluation of the CEL expression for the current test case.inthashCode()booleanInput in the form of a context proto for the test case.booleanExpected result of the test case.protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTableprotected com.google.protobuf.MapFieldReflectionAccessorinternalGetMapFieldReflection(int number) final booleanstatic TestCase.Builderstatic TestCase.BuildernewBuilder(TestCase prototype) protected TestCase.BuildernewBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) protected ObjectnewInstance(com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter unused) static TestCaseparseDelimitedFrom(InputStream input) static TestCaseparseDelimitedFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) static TestCaseparseFrom(byte[] data) static TestCaseparseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) static TestCaseparseFrom(com.google.protobuf.ByteString data) static TestCaseparseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) static TestCaseparseFrom(com.google.protobuf.CodedInputStream input) static TestCaseparseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) static TestCaseparseFrom(InputStream input) static TestCaseparseFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) static TestCaseparseFrom(ByteBuffer data) static TestCaseparseFrom(ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) static com.google.protobuf.Parser<TestCase>parser()voidwriteTo(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, writeStringNoTagMethods inherited from class com.google.protobuf.AbstractMessage
findInitializationErrors, getInitializationErrorString, hashBoolean, hashEnum, hashEnumList, hashFields, hashLong, toStringMethods inherited from class com.google.protobuf.AbstractMessageLite
addAll, addAll, checkByteStringIsUtf8, toByteArray, toByteString, writeDelimitedTo, writeToMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.google.protobuf.MessageLite
toByteArray, toByteString, writeDelimitedTo, writeToMethods inherited from interface com.google.protobuf.MessageOrBuilder
findInitializationErrors, getAllFields, getDescriptorForType, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof
-
Field Details
-
NAME_FIELD_NUMBER
public static final int NAME_FIELD_NUMBER- See Also:
-
DESCRIPTION_FIELD_NUMBER
public static final int DESCRIPTION_FIELD_NUMBER- See Also:
-
EXPR_FIELD_NUMBER
public static final int EXPR_FIELD_NUMBER- See Also:
-
ENV_FIELD_NUMBER
public static final int ENV_FIELD_NUMBER- See Also:
-
INPUT_FIELD_NUMBER
public static final int INPUT_FIELD_NUMBER- See Also:
-
INPUT_CONTEXT_FIELD_NUMBER
public static final int INPUT_CONTEXT_FIELD_NUMBER- See Also:
-
OUTPUT_FIELD_NUMBER
public static final int OUTPUT_FIELD_NUMBER- See Also:
-
DEDUCED_TYPE_FIELD_NUMBER
public static final int DEDUCED_TYPE_FIELD_NUMBER- See Also:
-
DISABLE_CHECK_FIELD_NUMBER
public static final int DISABLE_CHECK_FIELD_NUMBER- See Also:
-
-
Method Details
-
newInstance
- Overrides:
newInstancein classcom.google.protobuf.GeneratedMessageV3
-
getDescriptor
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() -
internalGetMapFieldReflection
protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection(int number) - Overrides:
internalGetMapFieldReflectionin classcom.google.protobuf.GeneratedMessageV3
-
internalGetFieldAccessorTable
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()- Specified by:
internalGetFieldAccessorTablein classcom.google.protobuf.GeneratedMessageV3
-
getName
Name of the test case.
string name = 1;- Specified by:
getNamein interfaceTestCaseOrBuilder- Returns:
- The name.
-
getNameBytes
public com.google.protobuf.ByteString getNameBytes()Name of the test case.
string name = 1;- Specified by:
getNameBytesin interfaceTestCaseOrBuilder- Returns:
- The bytes for name.
-
getDescription
A description of the test.
string description = 2;- Specified by:
getDescriptionin interfaceTestCaseOrBuilder- Returns:
- The description.
-
getDescriptionBytes
public com.google.protobuf.ByteString getDescriptionBytes()A description of the test.
string description = 2;- Specified by:
getDescriptionBytesin interfaceTestCaseOrBuilder- Returns:
- The bytes for description.
-
getExpr
The text of the CEL expression.
string expr = 3;- Specified by:
getExprin interfaceTestCaseOrBuilder- Returns:
- The expr.
-
getExprBytes
public com.google.protobuf.ByteString getExprBytes()The text of the CEL expression.
string expr = 3;- Specified by:
getExprBytesin interfaceTestCaseOrBuilder- 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:
hasEnvin interfaceTestCaseOrBuilder- Returns:
- Whether the env field is set.
-
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:
getEnvin interfaceTestCaseOrBuilder- Returns:
- The env.
-
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:
getEnvOrBuilderin interfaceTestCaseOrBuilder
-
getInputCount
public int getInputCount()Description copied from interface:TestCaseOrBuilderA 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:
getInputCountin interfaceTestCaseOrBuilder
-
containsInput
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:
containsInputin interfaceTestCaseOrBuilder
-
getInput
Deprecated.UsegetInputMap()instead.- Specified by:
getInputin interfaceTestCaseOrBuilder
-
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:
getInputMapin interfaceTestCaseOrBuilder
-
getInputOrDefault
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:
getInputOrDefaultin interfaceTestCaseOrBuilder
-
getInputOrThrow
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:
getInputOrThrowin interfaceTestCaseOrBuilder
-
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:
hasInputContextin interfaceTestCaseOrBuilder- Returns:
- Whether the inputContext field is set.
-
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:
getInputContextin interfaceTestCaseOrBuilder- Returns:
- The inputContext.
-
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:
getInputContextOrBuilderin interfaceTestCaseOrBuilder
-
hasOutput
public boolean hasOutput()Expected result of the test case.
.cel.expr.conformance.test.TestOutput output = 7;- Specified by:
hasOutputin interfaceTestCaseOrBuilder- Returns:
- Whether the output field is set.
-
getOutput
Expected result of the test case.
.cel.expr.conformance.test.TestOutput output = 7;- Specified by:
getOutputin interfaceTestCaseOrBuilder- Returns:
- The output.
-
getOutputOrBuilder
Expected result of the test case.
.cel.expr.conformance.test.TestOutput output = 7;- Specified by:
getOutputOrBuilderin interfaceTestCaseOrBuilder
-
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:
hasDeducedTypein interfaceTestCaseOrBuilder- Returns:
- Whether the deducedType field is set.
-
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:
getDeducedTypein interfaceTestCaseOrBuilder- Returns:
- The deducedType.
-
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:
getDeducedTypeOrBuilderin interfaceTestCaseOrBuilder
-
getDisableCheck
public boolean getDisableCheck()Bypass the type-checking and only attempt to evaluate the parsed expression.
bool disable_check = 9;- Specified by:
getDisableCheckin interfaceTestCaseOrBuilder- Returns:
- The disableCheck.
-
isInitialized
public final boolean isInitialized()- Specified by:
isInitializedin interfacecom.google.protobuf.MessageLiteOrBuilder- Overrides:
isInitializedin classcom.google.protobuf.GeneratedMessageV3
-
writeTo
- Specified by:
writeToin interfacecom.google.protobuf.MessageLite- Overrides:
writeToin classcom.google.protobuf.GeneratedMessageV3- Throws:
IOException
-
getSerializedSize
public int getSerializedSize()- Specified by:
getSerializedSizein interfacecom.google.protobuf.MessageLite- Overrides:
getSerializedSizein classcom.google.protobuf.GeneratedMessageV3
-
equals
- Specified by:
equalsin interfacecom.google.protobuf.Message- Overrides:
equalsin classcom.google.protobuf.AbstractMessage
-
hashCode
public int hashCode()- Specified by:
hashCodein interfacecom.google.protobuf.Message- Overrides:
hashCodein classcom.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
- Throws:
IOException
-
parseFrom
public static TestCase parseFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException - Throws:
IOException
-
parseDelimitedFrom
- Throws:
IOException
-
parseDelimitedFrom
public static TestCase parseDelimitedFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException - Throws:
IOException
-
parseFrom
- Throws:
IOException
-
parseFrom
public static TestCase parseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException - Throws:
IOException
-
newBuilderForType
- Specified by:
newBuilderForTypein interfacecom.google.protobuf.Message- Specified by:
newBuilderForTypein interfacecom.google.protobuf.MessageLite
-
newBuilder
-
newBuilder
-
toBuilder
- Specified by:
toBuilderin interfacecom.google.protobuf.Message- Specified by:
toBuilderin interfacecom.google.protobuf.MessageLite
-
newBuilderForType
protected TestCase.Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) - Specified by:
newBuilderForTypein classcom.google.protobuf.GeneratedMessageV3
-
getDefaultInstance
-
parser
-
getParserForType
- Specified by:
getParserForTypein interfacecom.google.protobuf.Message- Specified by:
getParserForTypein interfacecom.google.protobuf.MessageLite- Overrides:
getParserForTypein classcom.google.protobuf.GeneratedMessageV3
-
getDefaultInstanceForType
- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageLiteOrBuilder- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageOrBuilder
-