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
30
30
31
31
import scala .concurrent .Await
32
32
import scala .concurrent .duration .Duration
33
+ import org .scalatest .Matchers ._
33
34
34
35
class SparkContextSuite extends SparkFunSuite with LocalSparkContext {
35
36
@@ -274,16 +275,13 @@ class SparkContextSuite extends SparkFunSuite with LocalSparkContext {
274
275
}
275
276
276
277
test(" calling multiple sc.stop() must not throw any exception" ) {
277
- try {
278
+ noException should be thrownBy {
278
279
sc = new SparkContext (new SparkConf ().setAppName(" test" ).setMaster(" local" ))
279
280
val cnt = sc.parallelize(1 to 4 ).count()
280
281
sc.cancelAllJobs()
281
282
sc.stop()
282
283
// call stop second time
283
284
sc.stop()
284
- } catch {
285
- case e : Exception =>
286
- fail(" calling multiple sc.stop() must not throw any exception" , e);
287
285
}
288
286
}
289
287
}
You can’t perform that action at this time.
0 commit comments