Skip to content

Commit 986aa14

Browse files
committed
feat: Migration Plugin needed
addSbtPlugin("ch.epfl.scala" % "sbt-scala3-migrate" % "0.7.1")
1 parent b4982df commit 986aa14

File tree

4 files changed

+20
-13
lines changed

4 files changed

+20
-13
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ class RestaurantDemoSpec extends Specification with RestaurantDemoDatabaseFuncti
153153
```shell
154154
docker rm -f mongodb;
155155
docker run -d --publish 27017:27017 --name mongodb mongocamp/mongodb:latest;
156-
sbt test
156+
sbt +test
157157
```
158158

159159
## Supporters

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ licenses += ("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0.html
4343
//crossScalaVersions := Seq("2.13.16")
4444
crossScalaVersions := Seq("3.6.0", "2.13.16")
4545

46-
scalaVersion := crossScalaVersions.value.last
46+
scalaVersion := crossScalaVersions.value.head
4747

4848
scalacOptions += "-deprecation"
4949

project/plugins.sbt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ addSbtPlugin("com.github.sbt" % "sbt-release" % "1.4.0")
2121

2222
addSbtPlugin("dev.quadstingray" %% "sbt-json" % "0.7.1")
2323

24+
addSbtPlugin("ch.epfl.scala" % "sbt-scala3-migrate" % "0.7.1")
25+
2426

2527
addDependencyTreePlugin
2628

src/test/scala/dev/mongocamp/driver/mongodb/DocumentIncludesSuite.scala

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,16 @@ import org.apache.lucene.search.MatchAllDocsQuery
1010
class DocumentIncludesSuite extends FunSuite with DocumentIncludes {
1111

1212
test("mapToBson should convert Map to Bson") {
13-
val map = Map("key" -> "value")
13+
val map = Map("key" -> "value")
1414
val bson = mapToBson(map)
1515
assert(bson.isInstanceOf[Document])
16+
assertEquals(bson.toBsonDocument.toJson(), "{\"key\":\"value\"}")
1617
assertEquals(bson.asInstanceOf[Document].getString("key"), "value")
1718
}
1819

1920
test("luceneQueryBson should convert Lucene Query to Bson") {
2021
val query = new MatchAllDocsQuery()
21-
val bson = luceneQueryBson(query)
22+
val bson = luceneQueryBson(query)
2223
assert(bson.isInstanceOf[Document])
2324
}
2425

@@ -27,55 +28,59 @@ class DocumentIncludesSuite extends FunSuite with DocumentIncludes {
2728
javaMap.put("key", "value")
2829
val document = documentFromJavaMap(javaMap)
2930
assert(document.isInstanceOf[Document])
31+
assertEquals(document.toBsonDocument.toJson(), "{\"key\":\"value\"}")
3032
assertEquals(document.getString("key"), "value")
3133
}
3234

3335
test("documentFromMutableMap should convert mutable.Map to Document") {
3436
val mutableMap: collection.mutable.Map[String, Any] = collection.mutable.Map("key" -> "value")
35-
val document = documentFromMutableMap(mutableMap)
37+
val document = documentFromMutableMap(mutableMap)
3638
assert(document.isInstanceOf[Document])
39+
assertEquals(document.toBsonDocument.toJson(), "{\"key\":\"value\"}")
3740
assertEquals(document.getString("key"), "value")
3841
}
3942

4043
test("documentFromScalaMap should convert Map to Document") {
41-
val map = Map("key" -> "value")
44+
val map = Map("key" -> "value")
4245
val document = documentFromScalaMap(map)
4346
assert(document.isInstanceOf[Document])
47+
assertEquals(document.toBsonDocument.toJson(), "{\"key\":\"value\"}")
4448
assertEquals(document.getString("key"), "value")
4549
}
4650

4751
test("documentFromDocument should convert org.bson.Document to Document") {
48-
val bsonDoc = new org.bson.Document("key", "value")
52+
val bsonDoc = new org.bson.Document("key", "value")
4953
val document = documentFromDocument(bsonDoc)
5054
assert(document.isInstanceOf[Document])
55+
assertEquals(document.toBsonDocument.toJson(), "{\"key\":\"value\"}")
5156
assertEquals(document.getString("key"), "value")
5257
}
5358

5459
test("mapFromDocument should convert Document to Map") {
5560
val document = Document("key" -> "value")
56-
val map = mapFromDocument(document)
61+
val map = mapFromDocument(document)
5762
assert(map.isInstanceOf[Map[_, _]])
5863
assertEquals(map("key"), "value")
5964
}
6065

6166
test("mapListFromDocuments should convert List of Documents to List of Maps") {
6267
val documents = List(Document("key" -> "value"))
63-
val mapList = mapListFromDocuments(documents)
68+
val mapList = mapListFromDocuments(documents)
6469
assert(mapList.isInstanceOf[List[_]])
6570
assertEquals(mapList.head("key"), "value")
6671
}
6772

6873
test("stringToObjectId should convert String to ObjectId") {
69-
val str = "507f1f77bcf86cd799439011"
74+
val str = "507f1f77bcf86cd799439011"
7075
val objectId = stringToObjectId(str)
7176
assert(objectId.isInstanceOf[ObjectId])
7277
assertEquals(objectId.toHexString, str)
7378
}
7479

7580
test("documentToObjectId should extract ObjectId from Document") {
76-
val objectId = new ObjectId()
77-
val document = Document(DatabaseProvider.ObjectIdKey -> objectId)
81+
val objectId = new ObjectId()
82+
val document = Document(DatabaseProvider.ObjectIdKey -> objectId)
7883
val extractedObjectId = documentToObjectId(document)
7984
assertEquals(extractedObjectId, objectId)
8085
}
81-
}
86+
}

0 commit comments

Comments
 (0)