-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
27 additions
and
1 deletion.
There are no files selected for viewing
28 changes: 27 additions & 1 deletion
28
...a/spark/commons/errorhandling/implementations/ErrorHandlingFilterRowsWithErrorsTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
|
||
} |