Skip to content

Commit

Permalink
Fixes #93 - Object test progress
Browse files Browse the repository at this point in the history
  • Loading branch information
TebaleloS committed Apr 19, 2023
1 parent 98ccd6f commit 1b29d6c
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
package za.co.absa.spark.commons.errorhandling.implementations
import org.scalatest.funsuite.AnyFunSuite
import za.co.absa.spark.commons.test.SparkTestBase
import za.co.absa.spark.commons.errorhandling.implementations.ErrorHandlingFilterRowsWithErrors

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

private val col1Name = "Col1"
private val col2Name = "Col2"
private val columnToAdd = "col3"
private val data = Seq(
(None, ""),
(Some(1), "a"),
(Some(2), "bb"),
(Some(3), "ccc")
).toDF(col1Name, col2Name)
private val expectedResults = Seq(
(None, "", "")
).toDF(col1Name,col2Name, columnToAdd)

test("Collect columns and aggregate the columns") {
val errorMessageArray = ErrorMessageArray()
Expand All @@ -26,7 +29,7 @@ class ErrorHandlingFilterRowsWithErrorsTest extends AnyFunSuite with SparkTestBa

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

assert(result == false)
assert(expectedResults == result)
}

}

0 comments on commit 1b29d6c

Please sign in to comment.