diff --git a/core/src/test/scala/doric/sem/ErrorsSpec.scala b/core/src/test/scala/doric/sem/ErrorsSpec.scala index 46860bebe..942eb43cb 100644 --- a/core/src/test/scala/doric/sem/ErrorsSpec.scala +++ b/core/src/test/scala/doric/sem/ErrorsSpec.scala @@ -3,6 +3,7 @@ package sem import doric.SparkSessionTestWrapper import org.apache.spark.sql.AnalysisException +import org.apache.spark.sql.types.StringType import org.scalatest.funspec.AnyFunSpecLike import org.scalatest.matchers.should.Matchers @@ -54,6 +55,26 @@ class ErrorsSpec err.hashCode() shouldNot be(err2.hashCode()) } + + it("should be equals if class and error message ar the same") { + val err = SparkErrorWrapper( + new Exception("this") + ) + val err2 = SparkErrorWrapper( + new Exception("this") + ) + + err.equals(err2) shouldBe true + } + + it("should NOT be equals if the second has no Throwable") { + val err = SparkErrorWrapper( + new Exception("this") + ) + val err2 = ColumnTypeError("myColumn", StringType, StringType) + + err.equals(err2) shouldBe false + } } }