From 8977afabdada7ac67340e291017cbc1355db5b9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Ferreira?= Date: Sat, 19 Feb 2022 02:34:03 +0000 Subject: [PATCH] Scala update scala test to 3.2.9 JAVA-4181 --- .../src/test/scala/org/mongodb/scala/bson/BaseSpec.scala | 5 +++-- build.gradle | 4 +++- .../scala/org/mongodb/scala/AggregateObservableSpec.scala | 1 - driver-scala/src/test/scala/org/mongodb/scala/BaseSpec.scala | 5 +++-- .../scala/org/mongodb/scala/ChangeStreamObservableSpec.scala | 3 +-- .../org/mongodb/scala/CreateIndexCommitQuorumSpec.scala | 4 ---- .../scala/org/mongodb/scala/DistinctObservableSpec.scala | 1 - .../org/mongodb/scala/ListCollectionsObservableSpec.scala | 1 - .../org/mongodb/scala/ListDatabasesObservableSpec.scala | 1 - .../scala/org/mongodb/scala/ListIndexesObservableSpec.scala | 1 - .../scala/org/mongodb/scala/MapReduceObservableSpec.scala | 1 - .../scala/org/mongodb/scala/MongoClientSettingsSpec.scala | 1 - .../test/scala/org/mongodb/scala/MongoCollectionSpec.scala | 1 - .../test/scala/org/mongodb/scala/MongoCredentialSpec.scala | 1 - .../src/test/scala/org/mongodb/scala/MongoDatabaseSpec.scala | 1 - .../scala/org/mongodb/scala/MongoDriverInformationSpec.scala | 2 -- .../test/scala/org/mongodb/scala/ReadConcernLevelSpec.scala | 1 - .../src/test/scala/org/mongodb/scala/ReadConcernSpec.scala | 1 - .../test/scala/org/mongodb/scala/ReadPreferenceSpec.scala | 2 -- 19 files changed, 10 insertions(+), 27 deletions(-) diff --git a/bson-scala/src/test/scala/org/mongodb/scala/bson/BaseSpec.scala b/bson-scala/src/test/scala/org/mongodb/scala/bson/BaseSpec.scala index aa8780af4d5..ad6cab0069a 100644 --- a/bson-scala/src/test/scala/org/mongodb/scala/bson/BaseSpec.scala +++ b/bson-scala/src/test/scala/org/mongodb/scala/bson/BaseSpec.scala @@ -16,8 +16,9 @@ package org.mongodb.scala.bson import org.junit.runner.RunWith -import org.scalatest.{ FlatSpec, Matchers } +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers import org.scalatestplus.junit.JUnitRunner @RunWith(classOf[JUnitRunner]) -abstract class BaseSpec extends FlatSpec with Matchers {} +abstract class BaseSpec extends AnyFlatSpec with Matchers {} diff --git a/build.gradle b/build.gradle index 047722cff69..9ed1d123ca7 100644 --- a/build.gradle +++ b/build.gradle @@ -106,7 +106,9 @@ configure(scalaProjects) { testImplementation(platform("org.junit:junit-bom:$junitBomVersion")) testImplementation("org.junit.vintage:junit-vintage-engine") - testImplementation('org.scalatest:scalatest_%%:3.0.8') + testImplementation('org.scalatest:scalatest-flatspec_%%:3.2.9') + testImplementation('org.scalatest:scalatest-shouldmatchers_%%:3.2.9') + testImplementation('org.scalatestplus:junit-4-13_%%:3.2.9.0') testImplementation('org.scalamock:scalamock_%%:4.4.0') testImplementation('ch.qos.logback:logback-classic:1.1.3') testImplementation('org.reflections:reflections:0.9.10') diff --git a/driver-scala/src/test/scala/org/mongodb/scala/AggregateObservableSpec.scala b/driver-scala/src/test/scala/org/mongodb/scala/AggregateObservableSpec.scala index 7e10ab096d6..ed092dc4d26 100644 --- a/driver-scala/src/test/scala/org/mongodb/scala/AggregateObservableSpec.scala +++ b/driver-scala/src/test/scala/org/mongodb/scala/AggregateObservableSpec.scala @@ -22,7 +22,6 @@ import java.util.concurrent.TimeUnit import com.mongodb.reactivestreams.client.AggregatePublisher import org.mongodb.scala.model.Collation import org.scalamock.scalatest.proxy.MockFactory -import org.scalatest.{ FlatSpec, Matchers } import scala.concurrent.duration.Duration diff --git a/driver-scala/src/test/scala/org/mongodb/scala/BaseSpec.scala b/driver-scala/src/test/scala/org/mongodb/scala/BaseSpec.scala index ad3e2670821..98ce89a88fe 100644 --- a/driver-scala/src/test/scala/org/mongodb/scala/BaseSpec.scala +++ b/driver-scala/src/test/scala/org/mongodb/scala/BaseSpec.scala @@ -15,9 +15,10 @@ */ package org.mongodb.scala -import org.scalatest.{ FlatSpec, Matchers } import org.junit.runner.RunWith +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers import org.scalatestplus.junit.JUnitRunner @RunWith(classOf[JUnitRunner]) -abstract class BaseSpec extends FlatSpec with Matchers {} +abstract class BaseSpec extends AnyFlatSpec with Matchers {} diff --git a/driver-scala/src/test/scala/org/mongodb/scala/ChangeStreamObservableSpec.scala b/driver-scala/src/test/scala/org/mongodb/scala/ChangeStreamObservableSpec.scala index 9a24fa9a98a..11c5f4b9aa7 100644 --- a/driver-scala/src/test/scala/org/mongodb/scala/ChangeStreamObservableSpec.scala +++ b/driver-scala/src/test/scala/org/mongodb/scala/ChangeStreamObservableSpec.scala @@ -24,10 +24,9 @@ import org.mongodb.scala.model.Collation import org.mongodb.scala.model.changestream.FullDocument import org.reactivestreams.Publisher import org.scalamock.scalatest.proxy.MockFactory -import org.scalatest.{ FlatSpec, Matchers } import scala.concurrent.duration.Duration -import scala.util.{ Failure, Success } +import scala.util.{ Success } class ChangeStreamObservableSpec extends BaseSpec with MockFactory { diff --git a/driver-scala/src/test/scala/org/mongodb/scala/CreateIndexCommitQuorumSpec.scala b/driver-scala/src/test/scala/org/mongodb/scala/CreateIndexCommitQuorumSpec.scala index 320d27ca3ad..1ecbb1443ba 100644 --- a/driver-scala/src/test/scala/org/mongodb/scala/CreateIndexCommitQuorumSpec.scala +++ b/driver-scala/src/test/scala/org/mongodb/scala/CreateIndexCommitQuorumSpec.scala @@ -18,10 +18,6 @@ package org.mongodb.scala import java.lang.reflect.Modifier.isStatic -import scala.collection.JavaConverters._ - -import org.scalatest.{ FlatSpec, Matchers } - class CreateIndexCommitQuorumSpec extends BaseSpec { "CreateIndexCommitQuorum" should "have the same methods as the wrapped CreateIndexCommitQuorum" in { diff --git a/driver-scala/src/test/scala/org/mongodb/scala/DistinctObservableSpec.scala b/driver-scala/src/test/scala/org/mongodb/scala/DistinctObservableSpec.scala index ca7aa97a372..872e51be365 100644 --- a/driver-scala/src/test/scala/org/mongodb/scala/DistinctObservableSpec.scala +++ b/driver-scala/src/test/scala/org/mongodb/scala/DistinctObservableSpec.scala @@ -21,7 +21,6 @@ import com.mongodb.reactivestreams.client.DistinctPublisher import org.mongodb.scala.model.Collation import org.reactivestreams.Publisher import org.scalamock.scalatest.proxy.MockFactory -import org.scalatest.{ FlatSpec, Matchers } import scala.concurrent.duration.Duration diff --git a/driver-scala/src/test/scala/org/mongodb/scala/ListCollectionsObservableSpec.scala b/driver-scala/src/test/scala/org/mongodb/scala/ListCollectionsObservableSpec.scala index 57113963b9a..e33a397a8e7 100644 --- a/driver-scala/src/test/scala/org/mongodb/scala/ListCollectionsObservableSpec.scala +++ b/driver-scala/src/test/scala/org/mongodb/scala/ListCollectionsObservableSpec.scala @@ -21,7 +21,6 @@ import java.util.concurrent.TimeUnit import com.mongodb.reactivestreams.client.ListCollectionsPublisher import org.reactivestreams.Publisher import org.scalamock.scalatest.proxy.MockFactory -import org.scalatest.{ FlatSpec, Matchers } import scala.concurrent.duration.Duration diff --git a/driver-scala/src/test/scala/org/mongodb/scala/ListDatabasesObservableSpec.scala b/driver-scala/src/test/scala/org/mongodb/scala/ListDatabasesObservableSpec.scala index 09698ac9353..d6202529403 100644 --- a/driver-scala/src/test/scala/org/mongodb/scala/ListDatabasesObservableSpec.scala +++ b/driver-scala/src/test/scala/org/mongodb/scala/ListDatabasesObservableSpec.scala @@ -20,7 +20,6 @@ import java.util.concurrent.TimeUnit import com.mongodb.reactivestreams.client.ListDatabasesPublisher import org.reactivestreams.Publisher import org.scalamock.scalatest.proxy.MockFactory -import org.scalatest.{ FlatSpec, Matchers } import scala.concurrent.duration.Duration diff --git a/driver-scala/src/test/scala/org/mongodb/scala/ListIndexesObservableSpec.scala b/driver-scala/src/test/scala/org/mongodb/scala/ListIndexesObservableSpec.scala index 1173adc79b3..63922aa0c20 100644 --- a/driver-scala/src/test/scala/org/mongodb/scala/ListIndexesObservableSpec.scala +++ b/driver-scala/src/test/scala/org/mongodb/scala/ListIndexesObservableSpec.scala @@ -20,7 +20,6 @@ import java.util.concurrent.TimeUnit import com.mongodb.reactivestreams.client.ListIndexesPublisher import org.reactivestreams.Publisher import org.scalamock.scalatest.proxy.MockFactory -import org.scalatest.{ FlatSpec, Matchers } import scala.concurrent.duration.Duration diff --git a/driver-scala/src/test/scala/org/mongodb/scala/MapReduceObservableSpec.scala b/driver-scala/src/test/scala/org/mongodb/scala/MapReduceObservableSpec.scala index dd4275c593b..9ebe742b579 100644 --- a/driver-scala/src/test/scala/org/mongodb/scala/MapReduceObservableSpec.scala +++ b/driver-scala/src/test/scala/org/mongodb/scala/MapReduceObservableSpec.scala @@ -22,7 +22,6 @@ import com.mongodb.client.model.MapReduceAction import com.mongodb.reactivestreams.client.MapReducePublisher import org.mongodb.scala.model.Collation import org.scalamock.scalatest.proxy.MockFactory -import org.scalatest.{ FlatSpec, Matchers } import scala.concurrent.duration.Duration diff --git a/driver-scala/src/test/scala/org/mongodb/scala/MongoClientSettingsSpec.scala b/driver-scala/src/test/scala/org/mongodb/scala/MongoClientSettingsSpec.scala index 1009022fe7f..95c2daa65ef 100644 --- a/driver-scala/src/test/scala/org/mongodb/scala/MongoClientSettingsSpec.scala +++ b/driver-scala/src/test/scala/org/mongodb/scala/MongoClientSettingsSpec.scala @@ -22,7 +22,6 @@ import org.mongodb.scala.MongoClient.DEFAULT_CODEC_REGISTRY import org.mongodb.scala.bson.codecs.DocumentCodecProvider import org.mongodb.scala.connection.ConnectionPoolSettings.Builder import org.scalamock.scalatest.proxy.MockFactory -import org.scalatest.{ FlatSpec, Matchers } import org.mongodb.scala.connection._ class MongoClientSettingsSpec extends BaseSpec with MockFactory { diff --git a/driver-scala/src/test/scala/org/mongodb/scala/MongoCollectionSpec.scala b/driver-scala/src/test/scala/org/mongodb/scala/MongoCollectionSpec.scala index 4cba24747af..dee52bef52f 100644 --- a/driver-scala/src/test/scala/org/mongodb/scala/MongoCollectionSpec.scala +++ b/driver-scala/src/test/scala/org/mongodb/scala/MongoCollectionSpec.scala @@ -24,7 +24,6 @@ import org.bson.codecs.BsonValueCodecProvider import org.bson.codecs.configuration.CodecRegistries.fromProviders import org.mongodb.scala.model._ import org.scalamock.scalatest.proxy.MockFactory -import org.scalatest.{ FlatSpec, Matchers } import scala.collection.JavaConverters._ diff --git a/driver-scala/src/test/scala/org/mongodb/scala/MongoCredentialSpec.scala b/driver-scala/src/test/scala/org/mongodb/scala/MongoCredentialSpec.scala index cfdc5e00265..e1d2ccf7017 100644 --- a/driver-scala/src/test/scala/org/mongodb/scala/MongoCredentialSpec.scala +++ b/driver-scala/src/test/scala/org/mongodb/scala/MongoCredentialSpec.scala @@ -17,7 +17,6 @@ package org.mongodb.scala import com.mongodb.{ MongoCredential => JMongoCredential } -import org.scalatest.{ FlatSpec, Matchers } class MongoCredentialSpec extends BaseSpec { diff --git a/driver-scala/src/test/scala/org/mongodb/scala/MongoDatabaseSpec.scala b/driver-scala/src/test/scala/org/mongodb/scala/MongoDatabaseSpec.scala index 78d393881a6..190d311d514 100644 --- a/driver-scala/src/test/scala/org/mongodb/scala/MongoDatabaseSpec.scala +++ b/driver-scala/src/test/scala/org/mongodb/scala/MongoDatabaseSpec.scala @@ -26,7 +26,6 @@ import com.mongodb.reactivestreams.client.{ ListCollectionsPublisher, MongoDatab import org.mongodb.scala.bson.conversions.Bson import org.mongodb.scala.model._ import org.scalamock.scalatest.proxy.MockFactory -import org.scalatest.{ FlatSpec, Matchers } class MongoDatabaseSpec extends BaseSpec with MockFactory { diff --git a/driver-scala/src/test/scala/org/mongodb/scala/MongoDriverInformationSpec.scala b/driver-scala/src/test/scala/org/mongodb/scala/MongoDriverInformationSpec.scala index fcd925f2cb0..f6e1f994073 100644 --- a/driver-scala/src/test/scala/org/mongodb/scala/MongoDriverInformationSpec.scala +++ b/driver-scala/src/test/scala/org/mongodb/scala/MongoDriverInformationSpec.scala @@ -18,8 +18,6 @@ package org.mongodb.scala import java.lang.reflect.Modifier.isStatic -import org.scalatest.{ FlatSpec, Matchers } - class MongoDriverInformationSpec extends BaseSpec { "MongoDriverInformation" should "have the same static fields as the wrapped MongoDriverInformation" in { diff --git a/driver-scala/src/test/scala/org/mongodb/scala/ReadConcernLevelSpec.scala b/driver-scala/src/test/scala/org/mongodb/scala/ReadConcernLevelSpec.scala index f1f871a557b..9c113dea99a 100644 --- a/driver-scala/src/test/scala/org/mongodb/scala/ReadConcernLevelSpec.scala +++ b/driver-scala/src/test/scala/org/mongodb/scala/ReadConcernLevelSpec.scala @@ -21,7 +21,6 @@ import java.lang.reflect.Modifier._ import scala.util.{ Success, Try } import org.scalatest.prop.TableDrivenPropertyChecks._ -import org.scalatest.{ FlatSpec, Matchers } class ReadConcernLevelSpec extends BaseSpec { diff --git a/driver-scala/src/test/scala/org/mongodb/scala/ReadConcernSpec.scala b/driver-scala/src/test/scala/org/mongodb/scala/ReadConcernSpec.scala index a3ec600e314..3dea5a8a236 100644 --- a/driver-scala/src/test/scala/org/mongodb/scala/ReadConcernSpec.scala +++ b/driver-scala/src/test/scala/org/mongodb/scala/ReadConcernSpec.scala @@ -21,7 +21,6 @@ import java.lang.reflect.Modifier._ import com.mongodb.{ ReadConcern => JReadConcern } import org.scalatest.prop.TableDrivenPropertyChecks._ -import org.scalatest.{ FlatSpec, Matchers } class ReadConcernSpec extends BaseSpec { diff --git a/driver-scala/src/test/scala/org/mongodb/scala/ReadPreferenceSpec.scala b/driver-scala/src/test/scala/org/mongodb/scala/ReadPreferenceSpec.scala index 733ab814fd7..e6e9a762391 100644 --- a/driver-scala/src/test/scala/org/mongodb/scala/ReadPreferenceSpec.scala +++ b/driver-scala/src/test/scala/org/mongodb/scala/ReadPreferenceSpec.scala @@ -22,8 +22,6 @@ import java.util.concurrent.TimeUnit.SECONDS import scala.collection.JavaConverters._ import scala.concurrent.duration.Duration -import org.scalatest.{ FlatSpec, Matchers } - class ReadPreferenceSpec extends BaseSpec { val duration = Duration("95 sec")