Skip to content
This repository has been archived by the owner on Mar 16, 2021. It is now read-only.

Convert thirtyinch module tests to Kotlin #174

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = "1.2.51"
ext.kotlin_version = "1.3.11"
repositories {
google()
jcenter()
Expand Down
3 changes: 3 additions & 0 deletions thirtyinch/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
apply plugin: 'com.android.library'
apply plugin: 'org.jetbrains.kotlin.android'
apply plugin: 'guru.stefma.bintrayrelease'

android {
Expand Down Expand Up @@ -42,6 +43,8 @@ dependencies {
testImplementation "junit:junit:$junitVersion"
testImplementation "org.mockito:mockito-core:$mockitoVersion"
testImplementation "org.assertj:assertj-core:$assertjVersion"
testImplementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation "io.mockk:mockk:1.8.13.kotlin13"

androidTestImplementation "com.android.support.test:runner:$supportTestVersion"
androidTestImplementation "org.mockito:mockito-core:$mockitoVersion"
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright (C) 2017 grandcentrix GmbH
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package net.grandcentrix.thirtyinch.test

import io.mockk.mockk
import io.mockk.verify
import net.grandcentrix.thirtyinch.TiPresenter
import net.grandcentrix.thirtyinch.TiView
import org.junit.*

class TestPresenterExampleTest {

private class LoginPresenter : TiPresenter<LoginView>() {

fun onSubmitClicked() {
sendToView { it.showError("No username entered") }
}
}

private interface LoginView : TiView {

fun showError(msg: String)
}

@Test
fun `test load data`() {
val loginPresenter = LoginPresenter()
val testPresenter = loginPresenter.test()
val view = testPresenter.attachView(mockk(relaxUnitFun = true))

loginPresenter.onSubmitClicked()
verify { view.showError("No username entered") }
}
}

This file was deleted.

Loading