From bfddcbb0ad586f08c6bd3ed11c8c3befc4f07f1f Mon Sep 17 00:00:00 2001 From: happytomatoe <2893931+happytomatoe@users.noreply.github.com> Date: Mon, 2 Sep 2024 13:54:02 +0200 Subject: [PATCH] Refactor --- .../mrpowers/spark/fast/tests/DataframeUtil.scala | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/scala/com/github/mrpowers/spark/fast/tests/DataframeUtil.scala b/src/main/scala/com/github/mrpowers/spark/fast/tests/DataframeUtil.scala index 1f3f6dc..4de2724 100644 --- a/src/main/scala/com/github/mrpowers/spark/fast/tests/DataframeUtil.scala +++ b/src/main/scala/com/github/mrpowers/spark/fast/tests/DataframeUtil.scala @@ -33,7 +33,8 @@ object DataframeUtil { else { val withEquals = actualSeq .zip(expectedSeq) - .map { case (actualRowField, expectedRowField) => (actualRowField, expectedRowField, actualRowField == expectedRowField) } + .map { case (actualRowField, expectedRowField) => + (actualRowField, expectedRowField, actualRowField == expectedRowField) } val allFieldsAreNotEqual = !withEquals.exists(_._3) if (allFieldsAreNotEqual) { List( @@ -43,10 +44,11 @@ object DataframeUtil { } else { val coloredDiff = withEquals - .map { case (actualRowField, expectedRowField, equal) => - if (equal) + .map { + case (actualRowField, expectedRowField, true) => (DarkGray(actualRowField.toString), DarkGray(expectedRowField.toString)) - else (Red(actualRowField.toString), Green(expectedRowField.toString)) + case (actualRowField, expectedRowField, false) => + (Red(actualRowField.toString), Green(expectedRowField.toString)) } val start = DarkGray("[") val sep = DarkGray(",")