title: spark unit testing with SharedSparkSession (org.apache.spark.sql.test.SharedSparkSession.eventually)
body: <p>I tried to write a simple unit for Spark join from the tutorial - <a href="https://medium.com/@eugene_lopatkin/apache-spark-unit-testing-part-2-spark-sql-35c76ed592b0" rel="nofollow noreferrer">Apache Spark Unit Testing Part 2 — Spark SQL</a>.
  Added all dependencies from reference and</p>
  <pre><code>  &quot;org.apache.spark&quot; %% &quot;spark-core&quot; % &quot;2.4.7&quot; % Test,
    &quot;org.apache.spark&quot; %% &quot;spark-core&quot; % &quot;2.4.7&quot; % Test classifier &quot;tests&quot;,
    &quot;org.scalatest&quot; %% &quot;scalatest&quot; % &quot;3.2.3&quot; % Test,
  </code></pre>
  <p>but can't add extended QueryTest because it involves AnyFunSuite in private class. Now the code looks like</p>
  <pre><code>class TestScalaCheck extends AnyFunSuite with SharedSparkSession {
    import testImplicits._
  
    test(&quot;join - join using&quot;) {
      val df = Seq(1, 2, 3).map(i =&gt; (i, i.toString)).toDF(&quot;int&quot;, &quot;str&quot;)
      val df2 = Seq(1, 2, 3).map(i =&gt; (i, (i + 1).toString)).toDF(&quot;int&quot;, &quot;str&quot;)
  
      checkAnswer(
        df.join(df2, &quot;int&quot;),
        Row(1, &quot;1&quot;, &quot;2&quot;) :: Row(2, &quot;2&quot;, &quot;3&quot;) :: Row(3, &quot;3&quot;, &quot;5&quot;) :: Nil)
    }
  </code></pre>
  <p>And it generates the exception message:</p>
  <pre><code>An exception or error caused a run to abort: org.apache.spark.sql.test.SharedSparkSession.eventually(Lorg/scalatest/concurrent/PatienceConfiguration$Timeout;Lorg/scalatest/concurrent/PatienceConfiguration$Interval;Lscala/Function0;Lorg/scalactic/source/Position;)Ljava/lang/Object; 
  java.lang.NoSuchMethodError: org.apache.spark.sql.test.SharedSparkSession.eventually(Lorg/scalatest/concurrent/PatienceConfiguration$Timeout;Lorg/scalatest/concurrent/PatienceConfiguration$Interval;Lscala/Function0;Lorg/scalactic/source/Position;)Ljava/lang/Object;
      at org.apache.spark.sql.test.SharedSparkSession.afterEach(SharedSparkSession.scala:135)
      at org.apache.spark.sql.test.SharedSparkSession.afterEach$(SharedSparkSession.scala:129)
      at lesson2.TestScalaCheck.afterEach(TestScalaCheck.scala:14)
      at org.scalatest.BeforeAndAfterEach.$anonfun$runTest$1(BeforeAndAfterEach.scala:247)
      at org.scalatest.Status.$anonfun$withAfterEffect$1(Status.scala:377)
      at org.scalatest.Status.$anonfun$withAfterEffect$1$adapted(Status.scala:373)
      at org.scalatest.SucceededStatus$.whenCompleted(Status.scala:462)
      at org.scalatest.Status.withAfterEffect(Status.scala:373)
      at org.scalatest.Status.withAfterEffect$(Status.scala:371)
      at org.scalatest.SucceededStatus$.withAfterEffect(Status.scala:434)
      at org.scalatest.BeforeAndAfterEach.runTest(BeforeAndAfterEach.scala:246)
      at org.scalatest.BeforeAndAfterEach.runTest$(BeforeAndAfterEach.scala:227)
      at lesson2.TestScalaCheck.runTest(TestScalaCheck.scala:14)
      at org.scalatest.funsuite.AnyFunSuiteLike.$anonfun$runTests$1(AnyFunSuiteLike.scala:233)
      at org.scalatest.SuperEngine.$anonfun$runTestsInBranch$1(Engine.scala:413)
      at scala.collection.immutable.List.foreach(List.scala:392)
      at org.scalatest.SuperEngine.traverseSubNodes$1(Engine.scala:401)
      at org.scalatest.SuperEngine.runTestsInBranch(Engine.scala:396)
      at org.scalatest.SuperEngine.runTestsImpl(Engine.scala:475)
      at org.scalatest.funsuite.AnyFunSuiteLike.runTests(AnyFunSuiteLike.scala:233)
      at org.scalatest.funsuite.AnyFunSuiteLike.runTests$(AnyFunSuiteLike.scala:232)
      at org.scalatest.funsuite.AnyFunSuite.runTests(AnyFunSuite.scala:1563)
      at org.scalatest.Suite.run(Suite.scala:1112)
      at org.scalatest.Suite.run$(Suite.scala:1094)
      at org.scalatest.funsuite.AnyFunSuite.org$scalatest$funsuite$AnyFunSuiteLike$$super$run(AnyFunSuite.scala:1563)
      at org.scalatest.funsuite.AnyFunSuiteLike.$anonfun$run$1(AnyFunSuiteLike.scala:237)
      at org.scalatest.SuperEngine.runImpl(Engine.scala:535)
      at org.scalatest.funsuite.AnyFunSuiteLike.run(AnyFunSuiteLike.scala:237)
      at org.scalatest.funsuite.AnyFunSuiteLike.run$(AnyFunSuiteLike.scala:236)
      at lesson2.TestScalaCheck.org$scalatest$BeforeAndAfterAll$$super$run(TestScalaCheck.scala:14)
      at org.scalatest.BeforeAndAfterAll.liftedTree1$1(BeforeAndAfterAll.scala:213)
      at org.scalatest.BeforeAndAfterAll.run(BeforeAndAfterAll.scala:210)
      at org.scalatest.BeforeAndAfterAll.run$(BeforeAndAfterAll.scala:208)
      at lesson2.TestScalaCheck.run(TestScalaCheck.scala:14)
      at org.scalatest.tools.SuiteRunner.run(SuiteRunner.scala:45)
      at org.scalatest.tools.Runner$.$anonfun$doRunRunRunDaDoRunRun$13(Runner.scala:1320)
      at org.scalatest.tools.Runner$.$anonfun$doRunRunRunDaDoRunRun$13$adapted(Runner.scala:1314)
      at scala.collection.immutable.List.foreach(List.scala:392)
      at org.scalatest.tools.Runner$.doRunRunRunDaDoRunRun(Runner.scala:1314)
      at org.scalatest.tools.Runner$.$anonfun$runOptionallyWithPassFailReporter$24(Runner.scala:993)
      at org.scalatest.tools.Runner$.$anonfun$runOptionallyWithPassFailReporter$24$adapted(Runner.scala:971)
      at org.scalatest.tools.Runner$.withClassLoaderAndDispatchReporter(Runner.scala:1480)
      at org.scalatest.tools.Runner$.runOptionallyWithPassFailReporter(Runner.scala:971)
      at org.scalatest.tools.Runner$.run(Runner.scala:798)
      at org.scalatest.tools.Runner.run(Runner.scala)
      at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.runScalaTest2or3(ScalaTestRunner.java:38)
      at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.main(ScalaTestRunner.java:25)
   
  </code></pre>
  <p>Could you help me to resolve it?</p>
  <p>The original code is - <a href="https://github.com/apache/spark/blob/master/sql/core/src/test/scala/org/apache/spark/sql/DataFrameJoinSuite.scala" rel="nofollow noreferrer">DataFrameJoinSuite.scala</a></p>