Skip to content

Commit e7640e1

Browse files
committed
Add a test.
1 parent 1a78334 commit e7640e1

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ObjectExpressionsSuite.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,15 @@ class ObjectExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper {
8383
InternalRow.fromSeq(Seq()),
8484
"""A method named "nonexisting" is not declared in any enclosing class """ +
8585
"nor any supertype")
86+
87+
val initializeWithWrongParamType = InitializeJavaBean(
88+
Literal.fromObject(new TestBean),
89+
Map("setX" -> Literal("1")))
90+
intercept[Exception] {
91+
evaluateWithoutCodegen(initializeWithWrongParamType, InternalRow.fromSeq(Seq()))
92+
}.getMessage.contains(
93+
"""A method named "setX" is not declared in any enclosing class """ +
94+
"nor any supertype")
8695
}
8796

8897
test("SPARK-23585: UnwrapOption should support interpreted execution") {
@@ -127,3 +136,9 @@ class ObjectExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper {
127136
"The 0th field 'c0' of input row cannot be null.")
128137
}
129138
}
139+
140+
class TestBean extends Serializable {
141+
private var x: Int = 0
142+
143+
def setX(i: Int): Unit = x = i
144+
}

0 commit comments

Comments
 (0)