Package ee.jakarta.tck.el.spec.coercion
Class ELClientIT
java.lang.Object
ee.jakarta.tck.el.spec.coercion.ELClientIT
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanup()voidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidstatic StringtestPredicateLong(Predicate<Long> filter) static StringtestPredicateString(Predicate<String> filter) static inttestPrimitiveBooleanArray(boolean[] input)
-
Constructor Details
-
ELClientIT
public ELClientIT()
-
-
Method Details
-
cleanup
- Throws:
Exception
-
positivePrimitiveToBoxedTest
- Throws:
Exception- Test Name:
- positivePrimitiveToBoxedTest
- Assertion IDs:
- EL:SPEC:37.3; EL:SPEC:37.5
- Test Strategy:
- Validate that the primitive types - boolean - char - byte - short - int - long - float - double when found in an expression are converted to the appropriate 'boxed' types.
-
positiveBoxedToPrimitiveTest
- Throws:
Exception- Test Name:
- positiveBoxedToPrimitiveTest
- Assertion IDs:
- EL:SPEC:37.3; EL:SPEC:37.4
- Test Strategy:
- Validate that the 'boxed' types - Boolean - Character - Byte - Short - Integer - Long - Float - Double when found in an expression are converted to the appropriate primitive types. Note that the conversion takes place in ExprEval.evaluateValueExpression() when ExpressionFactory.createValueExpression() is called. When ValueExpression.getValue() is subsequently called, the primitive type is converted back to its 'boxed' type.
-
positiveElBooleanCoercionTest
- Throws:
Exception- Test Name:
- positiveElBooleanCoercionTest
- Assertion IDs:
- EL:SPEC:41.1; EL:SPEC:41.2; EL:SPEC:41.3
- Test Strategy:
- Validate that null, the empty String, a Boolean, and a proper String argument to Boolean.valueOf() are coerced to the expected Boolean values.
-
negativeElBooleanCoercionTest
- Throws:
Exception- Test Name:
- negativeElBooleanCoercionTest
- Assertion IDs:
- EL:SPEC:41.4; EL:JAVADOC:112
- Test Strategy:
- Validate that an error occurs when an attempt is made to coerce an invalid class to a Boolean. The coercion is performed with a call to ValueExpression.getValue(), which must throw an ELException.
-
elPrimitiveToStringCoercionTest
- Throws:
Exception- Test Name:
- elPrimitiveToStringCoercionTest
- Assertion IDs:
- EL:SPEC:38.1; EL:SPEC:38.2; EL:SPEC:38.3; EL:SPEC:38.5
- Test Strategy:
- Validate that the following types coerce to type of String and the expected String value is returned. Types: String(), boolean, null, byte, char, short, int, long, float, double, enum.
-
elWrapperToStringCoercionTest
- Throws:
Exception- Test Name:
- elWrapperToStringCoercionTest
- Assertion IDs:
- EL:SPEC:38.5
- Test Strategy:
- Validate that the following types coerce to type of String and the expected String value is returned. Types: Boolean, Byte, Character, Short, Integer, Long, Float, Double.
-
positiveElCharacterCoercionTest
- Throws:
Exception- Test Name:
- positiveElCharacterCoercionTest
- Assertion IDs:
- EL:SPEC:40.1; EL:SPEC:40.2; EL:SPEC:40.4; EL:SPEC:40.5
- Test Strategy:
- Validate that the following types coerce to type of Character and the expected Character value is returned. Types: String, Byte, Character, Short, Integer, Long, Float, Double, null, empty String.
-
negativeElCharacterCoercionTest
- Throws:
Exception- Test Name:
- negativeElCharacterCoercionTest
- Assertion IDs:
- EL:SPEC:40.3; EL:JAVADOC:112
- Test Strategy:
- Validate that an error occurs when an attempt is made to coerce a boolean to Character. The coercion is performed with a call to ValueExpression.getValue(), which must throw an ELException.
-
negativeElNumberCoercionTest
- Throws:
Exception- Test Name:
- negativeElNumberCoercionTest
- Assertion IDs:
- EL:SPEC:39.3; EL:SPEC:39.6.1.1; EL:SPEC:39.7.3; EL:SPEC:39.7.1; EL:SPEC:39.6.1.1; EL:JAVADOC:112
- Test Strategy:
- Validate that an error occurs when an attempt is made to coerce a: -Boolean to Number. -String to a Number. The coercion is performed with a call to ValueExpression.getValue(), which must throw an ELException.
-
elNullToNumberCoercionTest
- Throws:
Exception- Test Name:
- elNullToNumberCoercionTest
- Assertion IDs:
- EL:SPEC:39.1
- Test Strategy:
- Validate that when null or empty String is given. That the returned value is 0. Test this for the Following types. Types: Byte, Short, Integer, Long, Float, Double, BigDecimal, BigInteger.
-
elNumberToByteCoercionTest
- Throws:
Exception- Test Name:
- elNumberToByteCoercionTest
- Assertion IDs:
- EL:SPEC:39.5.3
- Test Strategy:
- Validate that following Number types coerce to Byte and the expected Byte value is returned. Types: Byte, Short, Integer, Long, Float, Double, BigDecimal, BigInteger.
-
elNumberToShortCoercionTest
- Throws:
Exception- Test Name:
- elNumberToShortCoercionTest
- Assertion IDs:
- EL:SPEC:39.5.4
- Test Strategy:
- Validate that following Number types coerce to Short and the expected Short value is returned. Types: Byte, Short, Integer, Long, Float, Double, BigDecimal, BigInteger.
-
elNumberToIntegerCoercionTest
- Throws:
Exception- Test Name:
- elNumberToIntegerCoercionTest
- Assertion IDs:
- EL:SPEC:39.5.5
- Test Strategy:
- Validate that following Number types coerce to Integer and the expected Integer value is returned. Types: Byte, Short, Integer, Long, Float, Double, BigDecimal, BigInteger.
-
elNumberToLongCoercionTest
- Throws:
Exception- Test Name:
- elNumberToLongCoercionTest
- Assertion IDs:
- EL:SPEC:39.5.6
- Test Strategy:
- Validate that following Number types coerce to Long and the expected Long value is returned. Types: Byte, Short, Integer, Long, Float, Double, BigDecimal, BigInteger.
-
elNumberToFloatCoercionTest
- Throws:
Exception- Test Name:
- elNumberToFloatCoercionTest
- Assertion IDs:
- EL:SPEC:39.5.7
- Test Strategy:
- Validate that following Number types coerce to Float and the expected Float value is returned. Types: Byte, Short, Integer, Long, Float, Double, BigDecimal, BigInteger.
-
elNumberToDoubleCoercionTest
- Throws:
Exception- Test Name:
- elNumberToDoubleCoercionTest
- Assertion IDs:
- EL:SPEC:39.5.8
- Test Strategy:
- Validate that following Number types coerce to Double and the expected Double value is returned. Types: Byte, Short, Integer, Long, Float, Double, BigDecimal, BigInteger.
-
elStringToNumberCoercionTest
- Throws:
Exception- Test Name:
- elStringToNumberCoercionTest
- Assertion IDs:
- EL:SPEC:39.6.1.2; EL:SPEC:39.7.2; EL:SPEC:39.7.4
- Test Strategy:
- Validate that String types coerce to the following types and the expected value is returned. Types: Byte, Short, Integer, Long, Float, Double, BigDecimal, BigInteger.
-
elCharacterToNumberCoercionTest
- Throws:
Exception- Test Name:
- elCharacterToNumberCoercionTest
- Assertion IDs:
- EL:SPEC:39.2
- Test Strategy:
- Validate that Character types coerce to the following types and the expected value is returned. Types: Byte, Short, Integer, Long, Float, Double, BigDecimal, BigInteger.
-
elNumberToBigIntegerCoercionTest
- Throws:
Exception- Test Name:
- elNumberToBigIntegerCoercionTest
- Assertion IDs:
- EL:SPEC:39.5.1.1; EL:SPEC:39.5.1.2
- Test Strategy:
- Validate that following Number types coerce to BigInteger and the expected value is returned. Types: Byte, Short, Integer, Long, Float, Double, BigDecimal, BigInteger.
-
elNumberToBigDecimalCoercionTest
- Throws:
Exception- Test Name:
- elNumberToBigDecimalCoercionTest
- Assertion IDs:
- EL:SPEC:39.5.2.1; EL:SPEC:39.5.2.2
- Test Strategy:
- Validate that following Number types coerce to BigDecimal and the expected value is returned. Types: Byte, Short, Integer, Long, Float, Double, BigDecimal, BigInteger.
-
elCoerceToEnumTypeTest
- Throws:
Exception- Test Name:
- elCoerceToEnumTypeTest
- Assertion IDs:
- EL:SPEC:42.1; EL:SPEC:42.2; EL:SPEC:42.3; EL:SPEC:42.4
- Test Strategy:
- Validate that - an assignable enum type can be coerced to an enum - coercing a null value to an enum type returns a null value - coercing an empty string to an enum type returns a null value - coercing a string to an enum is successful if the string is identical to one of the enum values. If not, an ELException is thrown.
-
elCoerceToArrayTest
- Throws:
Exception- Test Name:
- elCoerceToArrayTest
- Assertion IDs:
- EL:SPEC:81.1; EL:SPEC:81.2; EL:SPEC:81.3; EL:SPEC:81.4; EL:SPEC:81.5
- Test Strategy:
- Validate that - coercing a null to an array returns a null value, coercing an array of type T returns an array of type T, coercing an array coerces each member of the array to the expected type, coercing an array where at least one element cannot be coerced results in an ELException. If not, an ELException is thrown.
-
testPrimitiveBooleanArray
public static int testPrimitiveBooleanArray(boolean[] input) -
elCoerceLambdaExpressionToFunctionalInterfaceTest
- Throws:
Exception- Test Name:
- elCoerceLambdaExpressionToFunctionalInterfaceTest
- Assertion IDs:
- EL:SPEC:79.1; EL:SPEC:79.2; EL:SPEC:79.3
- Test Strategy:
- Validate that - a lambda expression can be coerced to a functional interface invocation if the parameter types match or can be made to match via the standard coercion rules.
-
testPredicateString
-
testPredicateLong
-
elCoerceToOtherTypeTest
- Throws:
Exception- Test Name:
- elCoerceToOtherTypeTest
- Assertion IDs:
- EL:SPEC:43.1; EL:SPEC:43.2
- Test Strategy:
- Validate that - an assignable "other" type can be coerced to an "other" type. We coerce an instance of the class java.sql.Time to its parent class java.util.Date. - coercing a null value to an "other" type returns a null value
-