Package dev.cel.expr.conformance.test
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 Summary
Modifier and TypeMethodDescriptionaddRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value) build()clear()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".A description of the test.Bypass the type-checking and only attempt to evaluate the parsed expression.clearEnv()Serialized environment to be used for compilation and evaluation of the CEL expression for the current test case.The text of the CEL expression.clearField(com.google.protobuf.Descriptors.FieldDescriptor field) Input in the form of a context proto for the test case.Name of the test case.clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) Expected result of the test case.clone()booleancontainsInput(String key) A map representing a variable binding where the key is the name of the input variable.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".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".A description of the test.com.google.protobuf.ByteStringA description of the test.static final com.google.protobuf.Descriptors.Descriptorcom.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.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.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.Deprecated.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.Expected result of the test case.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".booleanhasEnv()Serialized environment to be used for compilation and evaluation of the CEL expression for the current test case.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) protected com.google.protobuf.MapFieldReflectionAccessorinternalGetMutableMapFieldReflection(int number) final booleanmergeDeducedType(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".mergeEnv(Environment value) Serialized environment to be used for compilation and evaluation of the CEL expression for the current test case.mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) mergeFrom(com.google.protobuf.Message other) mergeInputContext(InputContext value) Input in the form of a context proto for the test case.mergeOutput(TestOutput value) Expected result of the test case.final TestCase.BuildermergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields) putAllInput(Map<String, InputValue> values) A map representing a variable binding where the key is the name of the input variable.putInput(String key, InputValue value) 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.removeInput(String key) A map representing a variable binding where the key is the name of the input variable.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".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".setDescription(String value) A description of the test.setDescriptionBytes(com.google.protobuf.ByteString value) A description of the test.setDisableCheck(boolean value) Bypass the type-checking and only attempt to evaluate the parsed expression.setEnv(Environment value) Serialized environment to be used for compilation and evaluation of the CEL expression for the current test case.setEnv(Environment.Builder builderForValue) Serialized environment to be used for compilation and evaluation of the CEL expression for the current test case.The text of the CEL expression.setExprBytes(com.google.protobuf.ByteString value) The text of the CEL expression.setInputContext(InputContext value) Input in the form of a context proto for the test case.setInputContext(InputContext.Builder builderForValue) Input in the form of a context proto for the test case.Name of the test case.setNameBytes(com.google.protobuf.ByteString value) Name of the test case.setOutput(TestOutput value) Expected result of the test case.setOutput(TestOutput.Builder builderForValue) Expected result of the test case.setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value) final TestCase.BuildersetUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields) Methods inherited from class com.google.protobuf.GeneratedMessageV3.Builder
getAllFields, getField, getFieldBuilder, getOneofFieldDescriptor, getParentForChildren, getRepeatedField, getRepeatedFieldBuilder, getRepeatedFieldCount, getUnknownFields, getUnknownFieldSetBuilder, hasField, hasOneof, internalGetMapField, internalGetMutableMapField, isClean, markClean, mergeUnknownLengthDelimitedField, mergeUnknownVarintField, newBuilderForField, onBuilt, onChanged, parseUnknownField, setUnknownFieldSetBuilder, setUnknownFieldsProto3Methods inherited from class com.google.protobuf.AbstractMessage.Builder
findInitializationErrors, getInitializationErrorString, internalMergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageException, toStringMethods inherited from class com.google.protobuf.AbstractMessageLite.Builder
addAll, addAll, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, newUninitializedMessageExceptionMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.google.protobuf.Message.Builder
mergeDelimitedFrom, mergeDelimitedFromMethods inherited from interface com.google.protobuf.MessageLite.Builder
mergeFromMethods inherited from interface com.google.protobuf.MessageOrBuilder
findInitializationErrors, getAllFields, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof
-
Method Details
-
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.Builder<TestCase.Builder>
-
internalGetMutableMapFieldReflection
protected com.google.protobuf.MapFieldReflectionAccessor internalGetMutableMapFieldReflection(int number) - Overrides:
internalGetMutableMapFieldReflectionin classcom.google.protobuf.GeneratedMessageV3.Builder<TestCase.Builder>
-
internalGetFieldAccessorTable
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()- Specified by:
internalGetFieldAccessorTablein classcom.google.protobuf.GeneratedMessageV3.Builder<TestCase.Builder>
-
clear
- Specified by:
clearin interfacecom.google.protobuf.Message.Builder- Specified by:
clearin interfacecom.google.protobuf.MessageLite.Builder- Overrides:
clearin classcom.google.protobuf.GeneratedMessageV3.Builder<TestCase.Builder>
-
getDescriptorForType
public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()- Specified by:
getDescriptorForTypein interfacecom.google.protobuf.Message.Builder- Specified by:
getDescriptorForTypein interfacecom.google.protobuf.MessageOrBuilder- Overrides:
getDescriptorForTypein classcom.google.protobuf.GeneratedMessageV3.Builder<TestCase.Builder>
-
getDefaultInstanceForType
- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageLiteOrBuilder- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageOrBuilder
-
build
- Specified by:
buildin interfacecom.google.protobuf.Message.Builder- Specified by:
buildin interfacecom.google.protobuf.MessageLite.Builder
-
buildPartial
- Specified by:
buildPartialin interfacecom.google.protobuf.Message.Builder- Specified by:
buildPartialin interfacecom.google.protobuf.MessageLite.Builder
-
clone
- Specified by:
clonein interfacecom.google.protobuf.Message.Builder- Specified by:
clonein interfacecom.google.protobuf.MessageLite.Builder- Overrides:
clonein classcom.google.protobuf.GeneratedMessageV3.Builder<TestCase.Builder>
-
setField
public TestCase.Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value) - Specified by:
setFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
setFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<TestCase.Builder>
-
clearField
- Specified by:
clearFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
clearFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<TestCase.Builder>
-
clearOneof
- Specified by:
clearOneofin interfacecom.google.protobuf.Message.Builder- Overrides:
clearOneofin classcom.google.protobuf.GeneratedMessageV3.Builder<TestCase.Builder>
-
setRepeatedField
public TestCase.Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value) - Specified by:
setRepeatedFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
setRepeatedFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<TestCase.Builder>
-
addRepeatedField
public TestCase.Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value) - Specified by:
addRepeatedFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
addRepeatedFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<TestCase.Builder>
-
mergeFrom
- Specified by:
mergeFromin interfacecom.google.protobuf.Message.Builder- Overrides:
mergeFromin classcom.google.protobuf.AbstractMessage.Builder<TestCase.Builder>
-
mergeFrom
-
isInitialized
public final boolean isInitialized()- Specified by:
isInitializedin interfacecom.google.protobuf.MessageLiteOrBuilder- Overrides:
isInitializedin classcom.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:
mergeFromin interfacecom.google.protobuf.Message.Builder- Specified by:
mergeFromin interfacecom.google.protobuf.MessageLite.Builder- Overrides:
mergeFromin classcom.google.protobuf.AbstractMessage.Builder<TestCase.Builder>- Throws:
IOException
-
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.
-
setName
Name of the test case.
string name = 1;- Parameters:
value- The name to set.- Returns:
- This builder for chaining.
-
clearName
Name of the test case.
string name = 1;- Returns:
- This builder for chaining.
-
setNameBytes
Name of the test case.
string name = 1;- Parameters:
value- The bytes for name to set.- Returns:
- This builder for chaining.
-
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.
-
setDescription
A description of the test.
string description = 2;- Parameters:
value- The description to set.- Returns:
- This builder for chaining.
-
clearDescription
A description of the test.
string description = 2;- Returns:
- This builder for chaining.
-
setDescriptionBytes
A description of the test.
string description = 2;- Parameters:
value- The bytes for description to set.- Returns:
- This builder for chaining.
-
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.
-
setExpr
The text of the CEL expression.
string expr = 3;- Parameters:
value- The expr to set.- Returns:
- This builder for chaining.
-
clearExpr
The text of the CEL expression.
string expr = 3;- Returns:
- This builder for chaining.
-
setExprBytes
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:
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.
-
setEnv
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
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
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
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
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
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
-
clearInput
-
removeInput
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.Use alternate mutation accessors instead. -
putInput
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
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
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:
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.
-
setInputContext
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
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
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
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
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
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.
-
setOutput
Expected result of the test case.
.cel.expr.conformance.test.TestOutput output = 7; -
setOutput
Expected result of the test case.
.cel.expr.conformance.test.TestOutput output = 7; -
mergeOutput
Expected result of the test case.
.cel.expr.conformance.test.TestOutput output = 7; -
clearOutput
Expected result of the test case.
.cel.expr.conformance.test.TestOutput output = 7; -
getOutputBuilder
Expected result of the test case.
.cel.expr.conformance.test.TestOutput output = 7; -
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.
-
setDeducedType
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
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
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
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
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
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.
-
setDisableCheck
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
Bypass the type-checking and only attempt to evaluate the parsed expression.
bool disable_check = 9;- Returns:
- This builder for chaining.
-
setUnknownFields
- Specified by:
setUnknownFieldsin interfacecom.google.protobuf.Message.Builder- Overrides:
setUnknownFieldsin classcom.google.protobuf.GeneratedMessageV3.Builder<TestCase.Builder>
-
mergeUnknownFields
- Specified by:
mergeUnknownFieldsin interfacecom.google.protobuf.Message.Builder- Overrides:
mergeUnknownFieldsin classcom.google.protobuf.GeneratedMessageV3.Builder<TestCase.Builder>
-