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 for the test caseName of the test case.clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) Expected result of the test case.clone()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()Input for the test caseInput for the test caseInput for the test casegetName()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.booleanhasInput()Input for the test casebooleanExpected result of the test case.protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTablefinal 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) mergeInput(TestInput value) Input for the test casemergeOutput(TestOutput value) Expected result of the test case.final TestCase.BuildermergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields) 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.Input for the test casesetInput(TestInput.Builder builderForValue) Input for the test caseName 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, internalGetMapFieldReflection, internalGetMutableMapField, internalGetMutableMapFieldReflection, 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() -
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
-
hasInput
public boolean hasInput()Input for the test case
.cel.expr.conformance.test.TestInput input = 5;- Specified by:
hasInputin interfaceTestCaseOrBuilder- Returns:
- Whether the input field is set.
-
getInput
Input for the test case
.cel.expr.conformance.test.TestInput input = 5;- Specified by:
getInputin interfaceTestCaseOrBuilder- Returns:
- The input.
-
setInput
Input for the test case
.cel.expr.conformance.test.TestInput input = 5; -
setInput
Input for the test case
.cel.expr.conformance.test.TestInput input = 5; -
mergeInput
Input for the test case
.cel.expr.conformance.test.TestInput input = 5; -
clearInput
Input for the test case
.cel.expr.conformance.test.TestInput input = 5; -
getInputBuilder
Input for the test case
.cel.expr.conformance.test.TestInput input = 5; -
getInputOrBuilder
Input for the test case
.cel.expr.conformance.test.TestInput input = 5;- Specified by:
getInputOrBuilderin interfaceTestCaseOrBuilder
-
hasOutput
public boolean hasOutput()Expected result of the test case.
.cel.expr.conformance.test.TestOutput output = 6;- Specified by:
hasOutputin interfaceTestCaseOrBuilder- Returns:
- Whether the output field is set.
-
getOutput
Expected result of the test case.
.cel.expr.conformance.test.TestOutput output = 6;- Specified by:
getOutputin interfaceTestCaseOrBuilder- Returns:
- The output.
-
setOutput
Expected result of the test case.
.cel.expr.conformance.test.TestOutput output = 6; -
setOutput
Expected result of the test case.
.cel.expr.conformance.test.TestOutput output = 6; -
mergeOutput
Expected result of the test case.
.cel.expr.conformance.test.TestOutput output = 6; -
clearOutput
Expected result of the test case.
.cel.expr.conformance.test.TestOutput output = 6; -
getOutputBuilder
Expected result of the test case.
.cel.expr.conformance.test.TestOutput output = 6; -
getOutputOrBuilder
Expected result of the test case.
.cel.expr.conformance.test.TestOutput output = 6;- 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 = 7;- 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 = 7;- 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 = 7; -
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 = 7; -
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 = 7; -
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 = 7; -
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 = 7; -
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 = 7;- Specified by:
getDeducedTypeOrBuilderin interfaceTestCaseOrBuilder
-
getDisableCheck
public boolean getDisableCheck()Bypass the type-checking and only attempt to evaluate the parsed expression.
bool disable_check = 8;- Specified by:
getDisableCheckin interfaceTestCaseOrBuilder- Returns:
- The disableCheck.
-
setDisableCheck
Bypass the type-checking and only attempt to evaluate the parsed expression.
bool disable_check = 8;- 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 = 8;- 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>
-