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 ab9f1e45c2a..e0d0a732294 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 @@ -111,12 +111,11 @@ object AssertionUtils { */ def assertContains(actual: TraversableOnce[AnyRef], expected: AnyRef*)(implicit prettifier: Prettifier, - pos: Position): Unit = { - val actualSeq = actual.toSeq + pos: Position): Unit = withClue(s", expected containing [${expected.mkString(", ")}]") { + val actualSeq = actual.toSeq expected.foreach { elem => assert(actualSeq.contains(elem))(prettifier, pos) } } - } /** * Asserts the string matches the regex @@ -124,9 +123,8 @@ object AssertionUtils { def assertMatches(actual: String, regex: Regex)(implicit prettifier: Prettifier, pos: Position): Unit = - withClue(s"'$actual' expected to match the regex '$regex'") { - assert(actual.matches(regex.regex))(prettifier, pos) - } + withClue(s"'$actual' expected to match the regex '$regex'")( + assert(actual.matches(regex.regex))(prettifier, pos)) /** * Asserts the string does not match the regex @@ -134,9 +132,8 @@ object AssertionUtils { def assertNotMatches(actual: String, regex: Regex)(implicit prettifier: Prettifier, pos: Position): Unit = - withClue(s"'$actual' expected not to match the regex '$regex'") { - assert(!actual.matches(regex.regex))(prettifier, pos) - } + withClue(s"'$actual' expected not to match the regex '$regex'")( + assert(!actual.matches(regex.regex))(prettifier, pos)) /** * Asserts that the given function throws an exception of the given type