# The set of evaluator tests
#######################################################
# basic literals
Expression: ${1}
ExpectedType: int
Evaluates to: 1
With type: java.lang.Integer
Expression: ${-12}
ExpectedType: int
Evaluates to: -12
With type: java.lang.Integer
Expression: ${true}
ExpectedType: boolean
Evaluates to: true
With type: java.lang.Boolean
Expression: ${false}
ExpectedType: boolean
Evaluates to: false
With type: java.lang.Boolean
Expression: ${null}
ExpectedType: class java.lang.String
Evaluates to:
With type: java.lang.String
Expression: ${4.2}
ExpectedType: double
Evaluates to: 4.2
With type: java.lang.Double
Expression: ${-21.3}
ExpectedType: float
Evaluates to: -21.3
With type: java.lang.Float
Expression: ${4.}
ExpectedType: float
Evaluates to: 4.0
With type: java.lang.Float
Expression: ${.21}
ExpectedType: float
Evaluates to: 0.21
With type: java.lang.Float
Expression: ${3e-1}
ExpectedType: double
Evaluates to: 0.3
With type: java.lang.Double
Expression: ${.2222222222}
ExpectedType: double
Evaluates to: 0.2222222222
With type: java.lang.Double
#######################################################
# basic relationals between literals
Expression: ${1 < 2}
ExpectedType: boolean
Evaluates to: true
With type: java.lang.Boolean
Expression: ${1 > 2}
ExpectedType: boolean
Evaluates to: false
With type: java.lang.Boolean
Expression: ${1 >= 2}
ExpectedType: boolean
Evaluates to: false
With type: java.lang.Boolean
Expression: ${1 <= 2}
ExpectedType: boolean
Evaluates to: true
With type: java.lang.Boolean
Expression: ${1 == 2}
ExpectedType: boolean
Evaluates to: false
With type: java.lang.Boolean
Expression: ${1 != 2}
ExpectedType: boolean
Evaluates to: true
With type: java.lang.Boolean
Expression: ${3 >= 3}
ExpectedType: boolean
Evaluates to: true
With type: java.lang.Boolean
Expression: ${3 <= 3}
ExpectedType: boolean
Evaluates to: true
With type: java.lang.Boolean
Expression: ${3 == 3}
ExpectedType: boolean
Evaluates to: true
With type: java.lang.Boolean
Expression: ${3 < 3}
ExpectedType: boolean
Evaluates to: false
With type: java.lang.Boolean
Expression: ${3 > 3}
ExpectedType: boolean
Evaluates to: false
With type: java.lang.Boolean
Expression: ${3 != 3}
ExpectedType: boolean
Evaluates to: false
With type: java.lang.Boolean
#######################################################
# relationals between booleans
Expression: ${false < true}
ExpectedType: class java.lang.Object
Evaluates to: javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${false < true}": Attempt to apply operator "<" to arguments of type "java.lang.Boolean" and "java.lang.Boolean"
With type: javax.servlet.jsp.JspException
Expression: ${false > true}
ExpectedType: class java.lang.Object
Evaluates to: javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${false > true}": Attempt to apply operator ">" to arguments of type "java.lang.Boolean" and "java.lang.Boolean"
With type: javax.servlet.jsp.JspException
Expression: ${true >= true}
ExpectedType: class java.lang.Object
Evaluates to: true
With type: java.lang.Boolean
Expression: ${true <= true}
ExpectedType: class java.lang.Object
Evaluates to: true
With type: java.lang.Boolean
Expression: ${true == true}
ExpectedType: class java.lang.Object
Evaluates to: true
With type: java.lang.Boolean
Expression: ${true != true}
ExpectedType: class java.lang.Object
Evaluates to: false
With type: java.lang.Boolean
#######################################################
# looking up objects in scopes
# val1a - defined in page scope
Expression: ${pageScope.val1a}
ExpectedType: class java.lang.String
Evaluates to: page-scoped1
With type: java.lang.String
Expression: ${requestScope.val1a}
ExpectedType: class java.lang.String
Evaluates to:
With type: java.lang.String
Expression: ${sessionScope.val1a}
ExpectedType: class java.lang.String
Evaluates to:
With type: java.lang.String
Expression: ${applicationScope.val1a}
ExpectedType: class java.lang.String
Evaluates to:
With type: java.lang.String
Expression: ${val1a}
ExpectedType: class java.lang.String
Evaluates to: page-scoped1
With type: java.lang.String
# val1b - defined in request scope
Expression: ${pageScope.val1b}
ExpectedType: class java.lang.String
Evaluates to:
With type: java.lang.String
Expression: ${requestScope.val1b}
ExpectedType: class java.lang.String
Evaluates to: request-scoped1
With type: java.lang.String
Expression: ${sessionScope.val1b}
ExpectedType: class java.lang.String
Evaluates to:
With type: java.lang.String
Expression: ${applicationScope.val1b}
ExpectedType: class java.lang.String
Evaluates to:
With type: java.lang.String
Expression: ${val1b}
ExpectedType: class java.lang.String
Evaluates to: request-scoped1
With type: java.lang.String
# val1c - defined in session scope
Expression: ${pageScope.val1c}
ExpectedType: class java.lang.String
Evaluates to:
With type: java.lang.String
Expression: ${requestScope.val1c}
ExpectedType: class java.lang.String
Evaluates to:
With type: java.lang.String
Expression: ${sessionScope.val1c}
ExpectedType: class java.lang.String
Evaluates to: session-scoped1
With type: java.lang.String
Expression: ${applicationScope.val1c}
ExpectedType: class java.lang.String
Evaluates to:
With type: java.lang.String
Expression: ${val1c}
ExpectedType: class java.lang.String
Evaluates to: session-scoped1
With type: java.lang.String
# val1d - defined in application scope
Expression: ${pageScope.val1d}
ExpectedType: class java.lang.String
Evaluates to:
With type: java.lang.String
Expression: ${requestScope.val1d}
ExpectedType: class java.lang.String
Evaluates to:
With type: java.lang.String
Expression: ${sessionScope.val1d}
ExpectedType: class java.lang.String
Evaluates to:
With type: java.lang.String
Expression: ${applicationScope.val1d}
ExpectedType: class java.lang.String
Evaluates to: app-scoped1
With type: java.lang.String
Expression: ${val1d}
ExpectedType: class java.lang.String
Evaluates to: app-scoped1
With type: java.lang.String
#######################################################
# accessing properties
Expression: ${bean1a.int1}
ExpectedType: int
Evaluates to: 4
With type: java.lang.Integer
Expression: ${bean1a.boolean1}
ExpectedType: boolean
Evaluates to: true
With type: java.lang.Boolean
Expression: ${bean1a.string1}
ExpectedType: class java.lang.String
Evaluates to: hello
With type: java.lang.String
Expression: ${bean1a.bean1.int2}
ExpectedType: int
Evaluates to: -224
With type: java.lang.Integer
Expression: ${bean1a.bean1.bean2.string2}
ExpectedType: class java.lang.String
Evaluates to: bean3's string
With type: java.lang.String
#######################################################
# test the entire conversion matrix
Expression: ${bean1a.byte1}
ExpectedType: byte
Evaluates to: 12
With type: java.lang.Byte
Expression: ${bean1a.byte1}
ExpectedType: char
Evaluates to:
With type: java.lang.Character
Expression: ${bean1a.byte1}
ExpectedType: short
Evaluates to: 12
With type: java.lang.Short
Expression: ${bean1a.byte1}
ExpectedType: int
Evaluates to: 12
With type: java.lang.Integer
Expression: ${bean1a.byte1}
ExpectedType: long
Evaluates to: 12
With type: java.lang.Long
Expression: ${bean1a.byte1}
ExpectedType: float
Evaluates to: 12.0
With type: java.lang.Float
Expression: ${bean1a.byte1}
ExpectedType: double
Evaluates to: 12.0
With type: java.lang.Double
Expression: ${bean1a.char1}
ExpectedType: byte
Evaluates to: 98
With type: java.lang.Byte
Expression: ${bean1a.char1}
ExpectedType: char
Evaluates to: b
With type: java.lang.Character
Expression: ${bean1a.char1}
ExpectedType: short
Evaluates to: 98
With type: java.lang.Short
Expression: ${bean1a.char1}
ExpectedType: int
Evaluates to: 98
With type: java.lang.Integer
Expression: ${bean1a.char1}
ExpectedType: long
Evaluates to: 98
With type: java.lang.Long
Expression: ${bean1a.char1}
评论1
最新资源