| value [m] | displayed string |
|---|---|
| 753 | 753 m |
| 1337 | 1.34 km |
| 15888 | 15.9 km |
| 31270 | 31 km |
| 51000 | >50 km |
This file contains hidden or 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 PromotionListContract { | |
| interface View : MvpView { | |
| fun listInit(): Observable<Any> | |
| fun render(viewState: ViewState) | |
| } | |
| abstract class Presenter : MviBasePresenter<View, ViewState>() | |
| data class ViewState( | |
| val promotionList: List<PromotionViewModel> = emptyList(), |
This file contains hidden or 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
| val testCases = mapOf( | |
| 61888.123 to ">50 km", | |
| 38777.23 to "38.8 km", | |
| 16984.44 to "17.0 km", | |
| 987.98 to "988 m" | |
| ) |
This file contains hidden or 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
| @RunWith(Parameterized::class) | |
| class FibonacciTest(private val fInput: Int, private val fExpected: Int) { | |
| @Test | |
| fun test() { | |
| assertEquals(fExpected, Fibonacci.compute(fInput)) | |
| } | |
| companion object { | |
| @JvmStatic |
This file contains hidden or 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 DistanceConverterSpecificiation : Spek({ | |
| describe("distance converter") { | |
| val testCases = mapOf( | |
| 61888.123 to ">50 km", | |
| 38777.23 to "38.8 km", | |
| 16984.44 to "17.0 km", | |
| 987.98 to "988 m" | |
| ) | |
| val converter = DistanceConverter() | |
| testCases.forEach { value, expectedValue -> |
This file contains hidden or 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
| testCases.forEach { value, expectedValue -> | |
| on("$value"){ | |
| it("should print $expectedValue"){} | |
| } | |
| } |
This file contains hidden or 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
| val testCases = mapOf( | |
| 61888.123 to ">50 km", | |
| 38777.23 to "38.8 km", | |
| 16984.44 to "17.0 km", | |
| 987.98 to "988 m" | |
| ) |
This file contains hidden or 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 DistanceConverterSpecificiation : Spek({ | |
| describe("distance converter") { | |
| val distanceConverter: DistanceConverter by memoized { | |
| DistanceConverter() | |
| } | |
| on("distance 61888.123m") { | |
| val testDistance = 61888.123 | |
| it("should return >50km") { | |
| val convert = distanceConverter.convert(testDistance) | |
| assertTrue(convert.contentEquals(">50km")) |
This file contains hidden or 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
| @Parameters | |
| public static Collection<Object[]> data() { | |
| return Arrays.asList(new Object[][] { | |
| { 0, 0 }, { 1, 1 }, { 2, 1 } | |
| }); | |
| } |
This file contains hidden or 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
| given("no people in repository"){ | |
| val view: PeopleListContract.View = mock() | |
| val repository : Repository<Person> = mock { | |
| on { getAll() } doReturn Single.error(Error("no data")) | |
| } | |
| val presenter = PeopleListPresenter(repository) | |
| on("presenter attach"){ | |
| presenter.attach(view) | |
| presenterAttachStandardFlow(view, presenter){ | |
| it("should not add anything to view"){ |