Kluent: java.lang.NoClassDefFoundError: kotlin/test/AssertionsKt Error

I have just added testImplementation ‘org.amshove.kluent:kluent-android:1.45’ to my Android project and when I run a simple test like this:

    @Test
    fun `this should be true`() {
            true.shouldBeTrue()
    }

the following error is thrown:

`java.lang.NoClassDefFoundError: kotlin/test/AssertionsKt

	at org.amshove.kluent.internal.AssertionsKt.assertTrue(Assertions.kt:7)
	at org.amshove.kluent.BasicKt.shouldBeTrue(Basic.kt:35)
	at ro.fortech.mindclub.validators.SimpleTest.this should be true(SimpleTest.kt:16)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: java.lang.ClassNotFoundException: kotlin.test.AssertionsKt

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 38 (24 by maintainers)

Most upvoted comments

@MarkusAmshove, testImplementation 'org.amshove.kluent:kluent-android:1.48' is working (without needing org.jetbrains.kotlin:kotlin-test:$kotlin_version)!!!

Running the tests via AS and command line both work for me 🎉.

Have you added org.jetbrains.kotlin:kotlin-test:$kotlin_version as testImplementation ?

The packages are now in sync again.

This is the change you’re looking for

@MarkusAmshove, I’m experiencing this issue on the latest AS stable 3.3.1 (February 2019).

Adding in that kotlin test dependency worked though 🍾.

I’m downloading Android Studio 3.3 at the moment and will report an issue 😃

Thank you, I’ll try to replicate it with my current android studio version and then with 3.3