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
{ | |
"glossary": { | |
"title": "example glossary", | |
"GlossDiv": { | |
"title": "S", | |
"GlossList": { | |
"GlossEntry": { | |
"ID": "SGML", |
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
{ | |
"geocoded_waypoints" : [ | |
{ | |
"geocoder_status" : "OK", | |
"place_id" : "EilLcm93b2RlcnNrYSAxMC0xNCwgMzEtMTQxIEtyYWvDs3csIFBvbHNrYQ", | |
"types" : [ "street_address" ] | |
}, | |
{ | |
"geocoder_status" : "OK", | |
"place_id" : "EiNwbGFjIE5vd3kgNCwgMzMtMzMyIEtyYWvDs3csIFBvbHNrYQ", |
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
on("presenter detach"){ | |
presenter.detach() | |
it("should dispose observables"){ | |
// | |
} | |
} |
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
interface PeopleListContract { | |
interface View { | |
fun addPeople(people: List<Person>) | |
fun showError(throwable: Throwable = Throwable()) | |
fun showLoading() | |
fun hideLoading() | |
} | |
interface Presenter { | |
fun attach(view: View) |
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
dependencies { | |
(...) | |
testImplementation unitTestDependencies.values() | |
testImplementation spekDependencies.values() | |
testImplementation kotlinTestDependencies.values() | |
} |
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
interface PeopleListContract { | |
interface View { | |
fun addPeople(people: List<Person>) | |
fun showError(throwable: Throwable = Throwable()) | |
fun showLoading() | |
fun hideLoading() | |
} | |
interface Presenter { | |
fun attach(view: View) |
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 PeopleListPresenter(private val repository: Repository<Person>) : PeopleListContract.Presenter { | |
var view: PeopleListContract.View? = null | |
override fun attach(view: PeopleListContract.View) { | |
this.view = view | |
loadPeople() | |
} | |
private fun loadPeople() { |
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
ext { | |
def JunitVersion = '4.12' | |
def KotlinMockitoVersion = '1.5.0' | |
def SpekVersion = "1.1.5" | |
unitTestDependencies = [ | |
junit : "junit:junit:${JunitVersion}", | |
] |
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
dependencies { | |
(...) | |
testImplementation unitTestDependencies.values() | |
testImplementation spekDependencies.values() | |
testImplementation kotlinTestDependencies.values() | |
} |
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
import org.jetbrains.spek.api.Spek | |
import org.jetbrains.spek.api.dsl.* | |
import org.junit.platform.runner.JUnitPlatform | |
import com.nhaarman.mockito_kotlin.* | |
import org.junit.runner.RunWith | |
@RunWith(JUnitPlatform::class) | |
object PeopleListTest : Spek({ | |
given("people exists in repository"){ | |
val view: PeopleListContract.View = mock() |
OlderNewer