File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed
core/src/test/scala/org/apache/spark Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ import org.apache.spark.util.Utils
3030
3131import scala .concurrent .Await
3232import scala .concurrent .duration .Duration
33+ import org .scalatest .Matchers ._
3334
3435class SparkContextSuite extends SparkFunSuite with LocalSparkContext {
3536
@@ -274,16 +275,13 @@ class SparkContextSuite extends SparkFunSuite with LocalSparkContext {
274275 }
275276
276277 test(" calling multiple sc.stop() must not throw any exception" ) {
277- try {
278+ noException should be thrownBy {
278279 sc = new SparkContext (new SparkConf ().setAppName(" test" ).setMaster(" local" ))
279280 val cnt = sc.parallelize(1 to 4 ).count()
280281 sc.cancelAllJobs()
281282 sc.stop()
282283 // call stop second time
283284 sc.stop()
284- } catch {
285- case e : Exception =>
286- fail(" calling multiple sc.stop() must not throw any exception" , e);
287285 }
288286 }
289287}
You can’t perform that action at this time.
0 commit comments