Skip to content

Group test stubs by feature #168

@milosmns

Description

@milosmns

Provide a brief summary of the planned work

Now that all packages are organized by feature, it is time to group the test tooling by feature. This work refers to the "Stubs" test tool.

Detailed overview

As the project was migrated from other languages, test stubs were dumped to the same file for convenience, growing to ~1000 lines. This is, of course, a red flag. 🚩

Now that the project is in a stable phase, it makes sense to regroup the stubs into feature-based groups.

Hint/location:

com.appifyhub.monolith.util.Stubs

Today:

object Stubs {

  // region Domain Models

  val userId = UserId(
    userId = "username",
    projectId = 1,
  )

  // endregion Domain Models

}

Tomorrow:

object Stubs {

  user: UserStubs // or whatever the name is

}

object UserStubs {

  val id = UserId(
    userId = "username",
    projectId = 1,
  )

}

This doesn't serve a cosmetic purpose only, but also helps with auto-complete in tests:

// before: autocomplete lists 300 properties from 'Stubs'
assertThat(expected).equalsTo(Stubs.userId)

// after: autocomplete lists only ~10 properties from 'Stubs', plus 10 from 'user'
assertThat(expected).equalsTo(Stubs.user.id)

List the acceptance criteria

  • All Stubs are grouped by feature, matching the feature packages
  • All tests are updated to use the new stubs structure, and passing

Include any additional notes (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementNew feature or requestPlannedPlanned and roadmapped work

    Type

    No type

    Projects

    Status

    Ready

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions