Skip to content

Commit 57edf78

Browse files
author
Roman Janusz
committed
improved testing of BsonTypeMetadata to expect multiple types
1 parent 7c832bc commit 57edf78

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

commons-mongo/jvm/src/test/scala/com/avsystem/commons/mongo/BsonInputOutputTest.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,9 @@ class BsonInputOutputTest extends AnyFunSuite with ScalaCheckPropertyChecks {
194194

195195

196196
def testMetadata(input: BsonInput)(implicit position: Position): Unit = {
197-
def testFieldType(input: ObjectInput)(tpe: BsonType): Unit = {
197+
def testFieldType(input: ObjectInput)(tpes: BsonType*): Unit = {
198198
val fieldInput = input.nextField()
199-
assert(fieldInput.readMetadata(BsonTypeMetadata).contains(tpe))
199+
assert(fieldInput.readMetadata(BsonTypeMetadata).exists(tpes.contains))
200200
fieldInput.skip()
201201
}
202202

@@ -217,7 +217,7 @@ class BsonInputOutputTest extends AnyFunSuite with ScalaCheckPropertyChecks {
217217
testFieldType(objectInput)(BsonType.STRING)
218218
testFieldType(objectInput)(BsonType.BOOLEAN)
219219
testFieldType(objectInput)(BsonType.INT32)
220-
testFieldType(objectInput)(BsonType.INT64)
220+
testFieldType(objectInput)(BsonType.INT32, BsonType.INT64)
221221
testFieldType(objectInput)(BsonType.DATE_TIME)
222222
testFieldType(objectInput)(BsonType.DOUBLE)
223223
testFieldType(objectInput)(BsonType.BINARY)

commons-mongo/jvm/src/test/scala/com/avsystem/commons/mongo/SomethingPlain.scala

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@ object SomethingPlain extends HasGenCodec[SomethingPlain] {
3333
string <- arbitrary[String]
3434
boolean <- arbitrary[Boolean]
3535
int <- arbitrary[Int]
36-
long <- Gen.oneOf(
37-
Gen.choose(Long.MinValue, Int.MinValue - 1L),
38-
Gen.choose(Int.MaxValue + 1L, Long.MaxValue),
39-
)
36+
long <- arbitrary[Long]
4037
timestamp <- arbitrary[JDate]
4138
double <- arbitrary[Double]
4239
binary <- Gen.buildableOf[Array[Byte], Byte](arbitrary[Byte]).map(new Bytes(_))

0 commit comments

Comments
 (0)