AssertionError not thrown on JUnit tests


I cloned the kotlin-koans repo and have made some changes to some unit tests. One thing that is very confusing is that the AssertionError does not seem to get thrown on an assertion like this one : assertTrue("This is wrong", false)

Am I missing something?


How and where did you call assertTrue. Normally it should, if the project is set up properly.
I guess you tried to add the assertTrue call in the one of the exercises and not in one of the unit tests. How exactly did you change the gradle build file to get the imports right? In case you added a compile dependency to “kotlin-test” try to change it to “kotlin-test-junit” as “kotlin-test” only contains the api but no actual implementation.


So I found out that the kotlin koans project is very different than other project setups. Any time you make a change in a unit test you have to rerun a Gradle task ( I forget which one) and after that finishes then it picks up the change you just made.


You shouldn’t have to. You can just run ./gradlew test again to restart the tests. This should automatically check whether it needs to recompile and do so if necessary.