Recipe Name:
JUnit: Mixed use of JUnit versions
Description:
This class is using multiple versions of JUnit. Consider standardizing to the latest JUnit version, and/or to AssertJ for assertions.
Level:
warning
Language:
  • java
Tags:
  • JUnit
  • testing
  • framework specific
  • JUnit 4
  • JUnit 5
  • quality
Recipe
id: scw:java:junit:mixed-versions
version: 10
metadata:
  name: 'JUnit: Mixed use of JUnit versions'
  shortDescription: This class is using multiple versions of JUnit. Consider standardizing to the latest JUnit version, and/or to AssertJ for assertions.
  level: warning
  language: java
  enabled: true
  comment: ""
  tags: JUnit;testing;framework specific;JUnit 4;JUnit 5;quality
search:
  class:
    in:
      file:
        allOf:
        - child:
            import:
              path:
                matches: ^org\.junit\.(?!jupiter).*
        - child:
            import:
              path:
                matches: ^org\.junit\.jupiter\..*
availableFixes:
- name: Get the AssertJ cookbook from Sensei Hub
  actions:
  - goto:
      type: URL
      value: https://sensei.securecodewarrior.com/cookbooks/scw:testing:assertj
      target: self