Skip to content

Commit 5ae934c

Browse files
committed
add test
1 parent 78ea0a1 commit 5ae934c

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/test/scala/com/github/swagger/pekko/converter/ModelPropertyParserTest.scala

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,21 @@ class ModelPropertyParserTest extends AnyFlatSpec with Matchers {
108108
model.get.getProperties should not be (null)
109109
val optInt = model.get.getProperties().get("optInt")
110110
optInt should not be (null)
111-
optInt shouldBe a [Schema[_]]
111+
optInt shouldBe an [IntegerSchema]
112+
optInt.asInstanceOf[IntegerSchema].getFormat shouldEqual "int32"
113+
nullSafeList(model.get.getRequired) shouldBe empty
114+
}
115+
116+
it should "process Model with Scala Option Long" in {
117+
val converter = ModelConverters.getInstance()
118+
val schemas = converter.readAll(classOf[ModelWOptionLong]).asScala.toMap
119+
val model = schemas.get("ModelWOptionLong")
120+
model shouldBe defined
121+
model.get.getProperties should not be (null)
122+
val optLong = model.get.getProperties().get("optLong")
123+
optLong should not be (null)
124+
optLong shouldBe a [IntegerSchema]
125+
optLong.asInstanceOf[IntegerSchema].getFormat shouldEqual "int64"
112126
nullSafeList(model.get.getRequired) shouldBe empty
113127
}
114128

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package models
2+
3+
case class ModelWOptionLong(optLong: Option[Long])

0 commit comments

Comments
 (0)