[test framework] add tests to ensure JUnit version-specific ignore methods work

GitOrigin-RevId: 2519e0ddb52843621e216b674bc5e8b54eee0701
This commit is contained in:
Vladislav Rassokhin
2024-12-10 13:53:42 +00:00
committed by intellij-monorepo-bot
parent 4fba5ac500
commit 09f1e8527d
6 changed files with 150 additions and 0 deletions
@@ -0,0 +1,21 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.testFramework.extensions.ignore
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
/**
* Tests to ensure [Disabled] annotation works for JUnit 5 test class.
*/
@Disabled("IJI-1434")
class DisabledJUnit5ClassTest {
/**
* A test which should never be executed.
* If executed, the test will immediately fail.
*/
@Test
fun testShouldNotBeExecuted() {
error("Test should not be executed")
}
}
@@ -0,0 +1,26 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.testFramework.extensions.ignore
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
/**
* Tests to ensure [Disabled] annotation works for JUnit 5 methods.
*/
class DisabledJUnit5MethodTest {
@Test
fun testShouldBeExecuted() {
}
/**
* A test which should never be executed.
* If executed, the test will immediately fail.
*/
@Disabled("IJI-1434")
@Test
fun testShouldNotBeExecuted() {
error("Test should not be executed")
}
}
@@ -0,0 +1,23 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.testFramework.extensions.ignore
import com.intellij.idea.IgnoreJUnit3
import com.intellij.testFramework.UsefulTestCase.IS_UNDER_TEAMCITY
import junit.framework.TestCase
/**
* Tests to ensure [IgnoreJUnit3] annotation works for JUnit 3 test class.
*/
@IgnoreJUnit3(reason = "IJI-1434")
class IgnoreJUnit3ClassTest : TestCase() {
/**
* A test which should never be executed under TeamCity.
* If executed, the test will immediately fail.
*/
fun testShouldNotBeExecuted() {
if (IS_UNDER_TEAMCITY) {
error("Test should not be executed under TeamCity")
}
}
}
@@ -0,0 +1,27 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.testFramework.extensions.ignore
import com.intellij.idea.IgnoreJUnit3
import com.intellij.testFramework.UsefulTestCase.IS_UNDER_TEAMCITY
import junit.framework.TestCase
/**
* Tests to ensure [IgnoreJUnit3] annotation works for JUnit 3 methods.
*/
class IgnoreJUnit3MethodTest : TestCase() {
fun testShouldBeExecuted() {
}
/**
* A test which should never be executed under TeamCity.
* If executed, the test will immediately fail.
*/
@IgnoreJUnit3(reason = "IJI-1434")
fun testShouldNotBeExecuted() {
if (IS_UNDER_TEAMCITY) {
error("Test should not be executed under TeamCity")
}
}
}
@@ -0,0 +1,24 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.testFramework.extensions.ignore
import com.intellij.testFramework.UsefulTestCase.IS_UNDER_TEAMCITY
import org.junit.Ignore
import org.junit.Test
/**
* Tests to ensure [Ignore] annotation works for JUnit 4 test class.
*/
@Ignore(value = "IJI-1434")
class IgnoreJUnit4ClassTest {
/**
* A test which should never be executed under TeamCity.
* If executed, the test will immediately fail.
*/
@Test
fun testShouldNotBeExecuted() {
if (IS_UNDER_TEAMCITY) {
error("Test should not be executed under TeamCity")
}
}
}
@@ -0,0 +1,29 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.testFramework.extensions.ignore
import com.intellij.testFramework.UsefulTestCase.IS_UNDER_TEAMCITY
import org.junit.Ignore
import org.junit.Test
/**
* Tests to ensure [Ignore] annotation works for JUnit 4 methods.
*/
class IgnoreJUnit4MethodTest {
@Test
fun testShouldBeExecuted() {
}
/**
* A test which should never be executed under TeamCity.
* If executed, the test will immediately fail.
*/
@Ignore(value = "IJI-1434")
@Test
fun testShouldNotBeExecuted() {
if (IS_UNDER_TEAMCITY) {
error("Test should not be executed under TeamCity")
}
}
}