Skip to content

Commit

Permalink
Fixes #93
Browse files Browse the repository at this point in the history
  • Loading branch information
TebaleloS committed Apr 18, 2023
1 parent 38ad8a6 commit fd89611
Showing 1 changed file with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,32 @@
package za.co.absa.spark.commons.errorhandling.implementations
import org.scalatest.funsuite.AnyFunSuite
import za.co.absa.spark.commons.test.SparkTestBase

class ErrorHandlingFilterRowsWithErrorsTest extends AnyFunSuite {
class ErrorHandlingFilterRowsWithErrorsTest extends AnyFunSuite with SparkTestBase {
import spark.implicits._

val errorHandlingFilterRowsWithErrors = new ErrorHandlingFilterRowsWithErrorsTest()
private val col1Name = "Col1"
private val col2Name = "Col2"
private val data = Seq(
(None, ""),
(Some(1), "a"),
(Some(2), "bb"),
(Some(3), "ccc")
).toDF(col1Name, col2Name)

test("") {
val errorMessageArray = ErrorMessageArray()

val e1 = errorMessageArray.putErrorToColumn("Test error 1", 1, "This is a test error", Some(col1Name))
val errorSubmitA = ErrorMessageSubmitOnColumn("Test error 2", 2, "This is a test error", col2Name)
val e2 = errorMessageArray.putErrorToColumn(errorSubmitA)
val errorSubmitB = ErrorMessageSubmitWithoutColumn("Test error 3", 3, "This is a test error")
val e3 = errorMessageArray.putErrorToColumn(errorSubmitB)

val result = ErrorHandlingFilterRowsWithErrors.aggregateErrorColumns(data)(e1, e2, e3)

assert(result == false)
}

}

0 comments on commit fd89611

Please sign in to comment.