тестовый класс находится в файле test/java/com/example/simpleunittest/ValidatorTest.kt
Код: Выделить всё
Validator.kt
Код: Выделить всё
package com.example.simpleunittest
object Validator {
fun sendboolean(param : Int) : Boolean {
if (param == 0) {
return false
} else if (param == 1) {
return false
}
return true
}
}
Код: Выделить всё
ValidatorTest.kt
Код: Выделить всё
package com.example.simpleunittest
import org.junit.Assert.*
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
@RunWith(JUnit4::class)
class ValidatorTest{
@Test
fun zero_returns_false() {
val validate = Validator
assertFalse(validate.sendboolean(0))
}
}
Код: Выделить всё
java.lang.NoClassDefFoundError: com/example/simpleunittest/Validator
п>
Подробнее здесь: https://stackoverflow.com/questions/793 ... st-unit-te