Skip to content

Instantly share code, notes, and snippets.

View travisdachi's full-sized avatar
🖖
Live long and prosper

Travis P travisdachi

🖖
Live long and prosper
View GitHub Profile
class Api @Inject constructor()
class MyPresenter @Inject constructor(val api: Api)
class MyActivity : Activity {
@Inject
lateinit var presenter: MyPresenter
}
class MyActivity : Activity {
val presenter: MyPresenter = MyPresenterImpl()
}
class MyPresenterImpl : MyPresenter
interface MyPresenter
class MyActivity : Activity {
val presenter: MyPresenterImpl = MyPresenterImpl()
}
class MyPresenterImpl
class MyPresenter(val api: Api, val view: MyView) {
fun onSubmitClick() {
api.submit().subscribe(
onNext = { data -> view.showSuccess(data) },
onError = { throwable -> view.showErrorDialog(throwable) }
)
}
}
fun testMyPresenterOnSubmitFail() {
class Car(val engine: Engine) {
fun start() {
engine.start()
}
}
dependencies {
implementation 'com.google.code.gson:gson:2.8.5'
}
class Car {
val engine = Engine()
fun start() {
engine.start()
}
}
class Engine {
fun start() = //...
}
@travisdachi
travisdachi / MainPage.kt
Last active August 25, 2017 07:42
MainPage for SampleTest
class MainPage(driver: AppiumDriver<WebElement>) {
init {
PageFactory.initElements(AppiumFieldDecorator(driver), this)
}
@AndroidFindBy(id = "com.blacklenspub.helloappium:id/tvLabel")
@iOSFindBy(xpath = "//XCUIElementTypeStaticText[1]")
lateinit var myLabel: WebElement
@AndroidFindBy(id = "com.blacklenspub.helloappium:id/btnGreet")