Skip to content

Commit

Permalink
Have constant for the field supertype
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-yevsyukov committed Oct 9, 2024
1 parent aaeef45 commit e5903dd
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ internal class OneofFieldCodegenSpec {
MessageGroupPlugin(),
MessageGroupPlugin.SETTINGS_ID
) {
const val FIELD_SUPERTYPE = "io.spine.core.EventContextField"

lateinit var code: String

@BeforeAll
Expand All @@ -69,7 +71,7 @@ internal class OneofFieldCodegenSpec {
override fun createSettings(projectDir: Path): GroupSettings {
val codegenConfig = createCodegenConfig(projectDir)
codegenConfig.forMessage("given.core.EventContext") {
it.markFieldsAs("io.spine.core.EventContextField")
it.markFieldsAs(FIELD_SUPERTYPE)
}
return codegenConfig.toProto().groupSettings
}
Expand All @@ -91,8 +93,8 @@ internal class OneofFieldCodegenSpec {
@Test
fun `generate field classes for nested message fields`() {
code shouldContain
"public static final class CommandIdField extends io.spine.core.EventContextField {"
"public static final class CommandIdField extends $FIELD_SUPERTYPE {"
code shouldContain
"public static final class EventIdField extends io.spine.core.EventContextField {"
"public static final class EventIdField extends $FIELD_SUPERTYPE {"
}
}

0 comments on commit e5903dd

Please sign in to comment.