-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6f63492
commit 4f9b336
Showing
2 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
oolong-bson/src/test/scala/oolong/bson/BsonMergeSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package oolong.bson | ||
|
||
import org.mongodb.scala.bson.* | ||
import org.scalatest.funsuite.AnyFunSuite | ||
import org.scalatest.matchers.should.Matchers | ||
|
||
class BsonMergeSpec extends AnyFunSuite with Matchers { | ||
test(":+ document merge") { | ||
val doc1 = BsonDocument("field1" -> 10, "field2" -> 30) | ||
val doc2 = BsonDocument("field1" -> 20, "field3" -> 40) | ||
|
||
val res = doc1 :+ doc2 | ||
|
||
res shouldBe BsonDocument("field1" -> 10, "field2" -> 30, "field3" -> 40) | ||
} | ||
|
||
test("+: document merge") { | ||
val doc1 = BsonDocument("field1" -> 10, "field2" -> 30) | ||
val doc2 = BsonDocument("field1" -> 20, "field3" -> 40) | ||
|
||
val res = doc1 +: doc2 | ||
|
||
res shouldBe BsonDocument("field1" -> 20, "field2" -> 30, "field3" -> 40) | ||
} | ||
} |