diff --git a/kyuubi-util-scala/src/test/scala/org/apache/kyuubi/util/AssertionUtils.scala b/kyuubi-util-scala/src/test/scala/org/apache/kyuubi/util/AssertionUtils.scala index 0a11480fc56..4c0d7a4e5a8 100644 --- a/kyuubi-util-scala/src/test/scala/org/apache/kyuubi/util/AssertionUtils.scala +++ b/kyuubi-util-scala/src/test/scala/org/apache/kyuubi/util/AssertionUtils.scala @@ -24,13 +24,14 @@ import scala.collection.Traversable import scala.io.Source import scala.reflect.ClassTag -import org.scalactic.{source, Prettifier} +import org.scalactic.Prettifier +import org.scalactic.source.Position import org.scalatest.Assertions._ object AssertionUtils { def assertEqualsIgnoreCase(expected: AnyRef)(actual: AnyRef)( - implicit pos: source.Position): Unit = { + implicit pos: Position): Unit = { val isEqualsIgnoreCase = (Option(expected), Option(actual)) match { case (Some(expectedStr: String), Some(actualStr: String)) => expectedStr.equalsIgnoreCase(actualStr) @@ -44,15 +45,15 @@ object AssertionUtils { } } - def assertStartsWithIgnoreCase(expectedPrefix: String)(actual: String)( - implicit pos: source.Position): Unit = { + def assertStartsWithIgnoreCase(expectedPrefix: String)(actual: String)(implicit + pos: Position): Unit = { if (!actual.toLowerCase(Locale.ROOT).startsWith(expectedPrefix.toLowerCase(Locale.ROOT))) { fail(s"Expected starting with '$expectedPrefix' ignoring case, but got [$actual]")(pos) } } - def assertExistsIgnoreCase(expected: String)(actual: Iterable[String])( - implicit pos: source.Position): Unit = { + def assertExistsIgnoreCase(expected: String)(actual: Iterable[String])(implicit + pos: Position): Unit = { if (!actual.exists(_.equalsIgnoreCase(expected))) { fail(s"Expected containing '$expected' ignoring case, but got [$actual]")(pos) } @@ -73,7 +74,7 @@ object AssertionUtils { regenScript: String, splitFirstExpectedLine: Boolean = false)(implicit prettifier: Prettifier, - pos: source.Position): Unit = { + pos: Position): Unit = { val fileSource = Source.fromFile(path.toUri, StandardCharsets.UTF_8.name()) try { def expectedLinesIter = if (splitFirstExpectedLine) { @@ -109,7 +110,7 @@ object AssertionUtils { */ def assertContains(iter: TraversableOnce[AnyRef], elems: AnyRef*)(implicit prettifier: Prettifier, - pos: source.Position): Unit = { + pos: Position): Unit = { val iterableSeq = iter.toSeq elems.foreach { elem => assert(iterableSeq.contains(elem), s", expected containing [${elems.mkString(", ")}]")( @@ -124,7 +125,7 @@ object AssertionUtils { */ def interceptEquals[T <: Exception](f: => Any)(expected: String)(implicit classTag: ClassTag[T], - pos: source.Position): Unit = { + pos: Position): Unit = { assert(expected != null) val exception = intercept[T](f)(classTag, pos) assertResult(expected)(exception.getMessage) @@ -136,7 +137,7 @@ object AssertionUtils { */ def interceptContains[T <: Exception](f: => Any)(contained: String)(implicit classTag: ClassTag[T], - pos: source.Position): Unit = { + pos: Position): Unit = { assert(contained != null) val exception = intercept[T](f)(classTag, pos) assert(exception.getMessage.contains(contained))