@@ -2,7 +2,16 @@ package com.github.swagger.enumeratum.converter
22
33import io .swagger .v3 .core .converter ._
44import io .swagger .v3 .oas .models .media ._
5- import models .{Ctx , ModelWCtxEnum , ModelWCtxEnumAndAnnotation , ModelWEnum , ModelWEnumAnnotated , ModelWEnumSet , ModelWOptionalEnum , OrderSize }
5+ import models .{
6+ Ctx ,
7+ ModelWCtxEnum ,
8+ ModelWCtxEnumAndAnnotation ,
9+ ModelWEnum ,
10+ ModelWEnumAnnotated ,
11+ ModelWEnumSet ,
12+ ModelWOptionalEnum ,
13+ OrderSize
14+ }
615import org .scalatest .OptionValues
716import org .scalatest .flatspec .AnyFlatSpec
817import org .scalatest .matchers .should .Matchers
@@ -14,32 +23,32 @@ class ModelPropertyParserTest extends AnyFlatSpec with Matchers with OptionValue
1423 val converter = ModelConverters .getInstance()
1524 val schemas = converter.readAll(classOf [ModelWEnum ]).asScala.toMap
1625 val model = findModel(schemas, " ModelWEnum" )
17- model should be (defined)
26+ model should be(defined)
1827 model.get.getProperties should not be (null )
1928 val field = model.value.getProperties.get(" field" )
20- field shouldBe a [StringSchema ]
29+ field shouldBe a[StringSchema ]
2130 field.asInstanceOf [StringSchema ].getEnum.asScala shouldEqual OrderSize .values.map(_.entryName)
2231 nullSafeList(model.value.getRequired) shouldBe Seq (" field" )
2332 }
2433 it should " process Model with Optional Enumeratum Enum" in {
2534 val converter = ModelConverters .getInstance()
2635 val schemas = converter.readAll(classOf [ModelWOptionalEnum ]).asScala.toMap
2736 val model = findModel(schemas, " ModelWOptionalEnum" )
28- model should be (defined)
37+ model should be(defined)
2938 model.get.getProperties should not be (null )
3039 val field = model.value.getProperties.get(" field" )
31- field shouldBe a [StringSchema ]
40+ field shouldBe a[StringSchema ]
3241 field.asInstanceOf [StringSchema ].getEnum.asScala shouldEqual OrderSize .values.map(_.entryName)
3342 nullSafeList(model.value.getRequired) shouldBe empty
3443 }
3544 it should " process Model with Enumeratum Set" in {
3645 val converter = ModelConverters .getInstance()
3746 val schemas = converter.readAll(classOf [ModelWEnumSet ]).asScala.toMap
3847 val model = findModel(schemas, " ModelWEnumSet" )
39- model should be (defined)
48+ model should be(defined)
4049 model.get.getProperties should not be (null )
4150 val field = model.value.getProperties.get(" sizes" )
42- field shouldBe a [ArraySchema ]
51+ field shouldBe a[ArraySchema ]
4352 val arraySchema = field.asInstanceOf [ArraySchema ]
4453 arraySchema.getItems.getEnum.asScala shouldEqual OrderSize .values.map(_.entryName)
4554 nullSafeList(model.value.getRequired) shouldEqual List (" sizes" )
@@ -48,10 +57,10 @@ class ModelPropertyParserTest extends AnyFlatSpec with Matchers with OptionValue
4857 val converter = ModelConverters .getInstance()
4958 val schemas = converter.readAll(classOf [ModelWEnumAnnotated ]).asScala.toMap
5059 val model = findModel(schemas, " ModelWEnumAnnotated" )
51- model should be (defined)
60+ model should be(defined)
5261 model.get.getProperties should not be (null )
5362 val field = model.value.getProperties.get(" field" )
54- field shouldBe a [StringSchema ]
63+ field shouldBe a[StringSchema ]
5564 val schema = field.asInstanceOf [StringSchema ]
5665 schema.getDescription shouldEqual " enum value"
5766 schema.getEnum.asScala shouldEqual OrderSize .values.map(_.entryName)
@@ -62,13 +71,13 @@ class ModelPropertyParserTest extends AnyFlatSpec with Matchers with OptionValue
6271 val schemas = converter.readAll(classOf [ModelWCtxEnum ]).asScala.toMap
6372 schemas.keys should have size 1
6473 val model = findModel(schemas, " ModelWCtxEnum" )
65- model should be (defined)
74+ model should be(defined)
6675 model.get.getProperties should not be (null )
6776 val field = model.value.getProperties.get(" field" )
68- field shouldBe a [StringSchema ]
77+ field shouldBe a[StringSchema ]
6978 val schema = field.asInstanceOf [StringSchema ]
7079 schema.getDescription shouldEqual (null )
71- schema.getDefault should be (null )
80+ schema.getDefault should be(null )
7281 schema.getEnum.asScala shouldEqual Ctx .Color .values.map(_.entryName)
7382 nullSafeList(model.value.getRequired) shouldBe Seq (" field" )
7483 }
@@ -86,8 +95,8 @@ class ModelPropertyParserTest extends AnyFlatSpec with Matchers with OptionValue
8695 val schema = field.asInstanceOf [StringSchema ]
8796 schema.getDescription shouldEqual " An annotated field"
8897 schema.getName shouldEqual " field"
89- schema.getDefault should be (null )
90- schema.getDeprecated should be (null )
98+ schema.getDefault should be(null )
99+ schema.getDeprecated should be(null )
91100 schema.getEnum.asScala shouldEqual Ctx .Color .values.map(_.entryName)
92101 nullSafeList(model.value.getRequired) shouldBe Seq (" field" )
93102 }
0 commit comments