It is a simple unit test, with only a single object and its corresponding unit test class. The object is in main/java/com/example/simpleunittest/Validator.kt
and
the test class is in test/java/com/example/simpleunittest/ValidatorTest.kt
Validator.kt
below:
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
below:
package com.example.simpleunittest
import .junit.Assert.*
import .junit.Test
import .junit.runner.RunWith
import .junit.runners.JUnit4
@RunWith(JUnit4::class)
class ValidatorTest{
@Test
fun zero_returns_false() {
val validate = Validator
assertFalse(validate.sendboolean(0))
}
}
and the error is:
java.lang.NoClassDefFoundError: com/example/simpleunittest/Validator
Please help why "Validator.kt" can not be found by "ValidatorTest.kt", and test fails.