Skip to content

Commit b1b8a67

Browse files
authored
add test case (#59)
1 parent 4dfcd20 commit b1b8a67

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/test/scala/ModelPropertyParserTest.scala

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,23 @@ class ModelPropertyParserTest extends AnyFlatSpec with Matchers with OptionValue
260260
mapSchema.getAdditionalProperties shouldBe a[StringProperty]
261261
}
262262

263+
it should "process EchoList" in {
264+
val converter = ModelConverters.getInstance()
265+
val schemas = converter.readAll(classOf[EchoList]).asScala.toMap
266+
val model = findModel(schemas, "EchoList")
267+
model should be (defined)
268+
model.value.getProperties should not be (null)
269+
val val1Field = model.value.getProperties.get("val1")
270+
val1Field shouldBe a [IntegerProperty]
271+
val val1Schema = val1Field.asInstanceOf[IntegerProperty]
272+
val1Schema.getRequired shouldBe true
273+
val val2Field = model.value.getProperties.get("val2")
274+
val2Field shouldBe a [IntegerProperty]
275+
val val2Schema = val2Field.asInstanceOf[IntegerProperty]
276+
val2Schema.getRequired shouldBe true
277+
}
278+
279+
263280
private def findModel(schemas: Map[String, Model], name: String): Option[Model] = {
264281
schemas.get(name) match {
265282
case Some(m) => Some(m)
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 EchoList(val1: Int, val2: Int, val3: Int)

0 commit comments

Comments
 (0)