-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Labels
Description
Hi,
would it be possible to make it such that the BaseIdRepository class implements some kind of trait which includes all the methods not in BaseIdQueries (e.g. findAll, deleteAll)? I am looking to use a cake pattern to allow easy mocking of the repositories for testing and it would be significantly easier if I could refactor them to be used as follows:
trait UserRepositoryComponent {
def userRepository: UserRepository
trait UserRepository extends BaseIdRepository[User,...]
}
trait PostgresUserRepositoryComponent {
val userRepository = new PostgresUserRepository
class PostgresUserRepository extends BaseIdRepositoryImpl[User,...]
}
trait TestUserRepositoryComponent {
val userRepository = mock[UserRepository]
}
It seems cleaner to mock the trait than having to mock the final class instead.
What do you think? I'm happy to work on a PR for this if you think it acceptable.
Cheers,
Hugh
Reactions are currently unavailable