Complete the code to define a use case class with an invoke operator function.
class GetUserNameUseCase { operator fun [1](): String { return "Alice" } }
The invoke operator allows the use case to be called like a function instance.
Complete the code to inject a repository into the use case constructor.
class GetUserAgeUseCase(private val [1]: UserRepository) { operator fun invoke(): Int { return repository.getAge() } }
The parameter name repository matches the usage inside the class.
Fix the error in the use case function to return the user email from repository.
class GetUserEmailUseCase(private val repository: UserRepository) { operator fun invoke(): String { return repository.[1]() } }
The repository method to get email is named getEmail().
Fill both blanks to create a use case that returns true if user is active.
class IsUserActiveUseCase(private val [1]: UserRepository) { operator fun [2](): Boolean { return [1].isActive() } }
The constructor parameter is named repository and the function uses the invoke operator.
Fill all three blanks to define a use case that takes a userId and returns user details.
class GetUserDetailsUseCase(private val [1]: UserRepository) { operator fun [2](userId: [3]): User { return [1].getUserById(userId) } }
The repository parameter is repository, the function is invoke, and the userId is a String.