I have a Kotlin project that uses JUnit 5.2.0. When I use IntelliJ to run tests, it runs all tests, even those annotated with @org.junit.Ignore.
package my.package
import org.junit.Ignore
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test
class ExampleTests {
@Test fun runMe() {
assertEquals(1, 1)
}
@Test @Ignore fun dontRunMe() {
assertEquals(1, 0)
}
}
Can anyone explain to me why this might be happening?
Figured out the answer: JUnit5 replaces JUnit4's @Ignore with @Disabled.
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
class ExampleTests {
@Test fun runMe() {
assertEquals(1, 1)
}
@Test @Disabled fun dontRunMe() {
assertEquals(1, 0)
}
}