Skip to content
This repository was archived by the owner on Mar 16, 2025. It is now read-only.

Commit 50a0a24

Browse files
committed
#91, test id/type distinction
1 parent d57880d commit 50a0a24

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

src/test/kotlin/io/openapiprocessor/core/model/datatypes/MappedDataTypeSpec.kt

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,46 @@ class MappedDataTypeSpec: StringSpec ({
5050
type.getImports() shouldBe data.imports
5151
}
5252
}
53+
54+
"get name of type with (optional) generic parameters & model name suffix" {
55+
class TypeName (val generics: List<DataTypeName>, val typeName: String)
56+
57+
withData(
58+
TypeName(listOf(
59+
DataTypeName("io.openapiprocessor.Bar", "io.openapiprocessor.BarSuffix")),
60+
"Foo<BarSuffix>"),
61+
TypeName(listOf(
62+
DataTypeName("io.openapiprocessor.Bar", "io.openapiprocessor.BarSuffix"),
63+
DataTypeName("io.openapiprocessor.Bar", "io.openapiprocessor.BarSuffix")),
64+
"Foo<BarSuffix, BarSuffix>")
65+
) { data ->
66+
val type = MappedDataType(
67+
"Foo",
68+
"model",
69+
data.generics)
70+
71+
type.getTypeName() shouldBe data.typeName
72+
}
73+
}
74+
75+
"get imports of type with (optional) generic parameters & model suffix" {
76+
class TypeImports (val generics: List<DataTypeName>, val imports: List<String>)
77+
78+
withData(
79+
TypeImports(listOf(
80+
DataTypeName("model.Bar", "model.BarSuffix")),
81+
listOf("model.Foo", "model.BarSuffix")),
82+
TypeImports(listOf(
83+
DataTypeName("model.Bar", "model.BarSuffix"),
84+
DataTypeName("model.Bar", "model.BarSuffix")),
85+
listOf("model.Foo", "model.BarSuffix"))
86+
) { data ->
87+
val type = MappedDataType(
88+
"Foo",
89+
"model",
90+
data.generics)
91+
92+
type.getImports() shouldBe data.imports
93+
}
94+
}
5395
})

0 commit comments

Comments
 (0)