This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TestingTripsController: TripsController { | |
override fun findTripsFor(userId: UserId): List<Trip> { | |
return listOf(tripToAmsterdam, tripToLondon) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open class TripsController { | |
... | |
fun someTripsCheck() { | |
... | |
val trips = findTripsFor(userId) | |
... | |
} | |
protected open fun findTripsFor(userId: UserId): List<Trip> { | |
return TripsDao.findTripsFor(userId) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TripsController { | |
... | |
fun someTripsCheck() { | |
... | |
val trips = TripsDao.findTripsFor(userId) | |
... | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
fun find_users_by_id() { | |
val userId = UUID.randomUUID() | |
val john = aUser().withUserId(userId).build() | |
val usersCatalog = InMemoryUsersCatalogIncluding(john) | |
val userFound = usersCatalog.findByUserId(userId) | |
assertEquals(john, userFound) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
fun find_users_by_id() { | |
val userId = UUID.randomUUID() | |
val john = User(userId, "John", "Doe", 30, Location.UNKNOWN) | |
val usersCatalog = InMemoryUsersCatalogIncluding(john) | |
val userFound = usersCatalog.findByUserId(userId) | |
assertEquals(john, userFound) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data class User( | |
val userId: UUID, | |
val firstName: String, | |
val lastName: String, | |
val age: Int, | |
val location: Location | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RoboTestRunner : AndroidJUnitRunner() { | |
override fun newApplication( | |
classLoader: ClassLoader?, | |
className: String?, | |
context: Context? | |
): Application { | |
return super.newApplication(classLoader, TestRoboApp::class.java.name, context) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Before | |
fun setUp() { | |
loadKoinModules(loginModule) | |
} | |
@After | |
fun tearDown() { | |
unloadKoinModules(loginModule) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TestRoboApp : Application() { | |
override fun onCreate() { | |
super.onCreate() | |
startKoin { } | |
} | |
override fun onTerminate() { | |
stopKoin() | |
super.onTerminate() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private val loginModule = module { | |
val credentialsValidator = LoginCredentialsValidator() | |
val loginApi = InMemoryLoginApi() | |
val loginRepository = RemoteLoginRepository(loginApi) | |
viewModel { | |
LoginViewModel(credentialsValidator, loginRepository) | |
} | |
} | |
@Before |
NewerOlder