java
config_error
ai_generated
true
java.lang.AssertionError: Test 'shouldFail' is disabled but still executed?
ID: java/junit-disabled-test-still-runs
80%Fix Rate
81%Confidence
0Evidence
2025-05-10First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 8+ | active | — | — | — |
Root Cause
Misuse of @Disabled annotation, or test runner ignores @Disabled due to configuration.
generic中文
@Disabled 注解使用不当,或测试运行器因配置忽略 @Disabled。
Workarounds
-
95% success Ensure @Disabled is on test method or class
@Disabled("Reason") @Test void test() { // disabled } -
80% success Check build configuration for JUnit vintage engine
// Ensure no conflicting test runners // Remove junit-vintage-engine if using JUnit 5 only
Dead Ends
Common approaches that don't work:
-
Removing @Disabled and commenting test
50% fail
Test becomes dead code; may be forgotten.
-
Using @Ignore instead (JUnit 4 style)
40% fail
JUnit 5 may not recognize @Ignore unless Jupiter API is used.