Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-4277

Junit 5 Migration

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None
    • None
    • 1.13
    • Yes

      With this Pull Request, it looks like Java 8 will be officially supported in Bukkit, although the code guidelines say that all code should be written without using Java 8 features unless otherwise impossible (and/or unreasonable?).

      Now that 1.13 has been out for a little while can we start a discussion (either here or on IRC), about updating the Bukkit/CraftBukkit tests to a supported framework. JUnit5 would allow us to remove a lot of unnecessary tests, as well as condense many tests into a single class. This would allow us to perform tests faster, and they would just be easier to maintain overall.

      For example, for Bukkit's tests the following tests could be condensed:

      • CropStateTest, CoalTypeTest, ArtTest, DifficultyTest, GameModeTest, GrassSpeciesTest,
        InstrumentTest, TreeSpeciesTest, WorldTypeTest

      (These are not definitive of the tests which could be improved, merely the tests which take an enum as a parameter in the Bukkit tests)

      As well, any test taking an Enum as a parameter could be parameterized very easily, and can have custom display names so we can condense those as well.
      JUnit5 also lets you test for failure, so we no longer would need a method for a single test that expects a single failure of a certain type.

      We can also support custom parameter types pretty easily within the class itself or via a custom 'ArgumentProvider' if we needed to use that same type of argument elsewhere.

      JUnit5 also lets you disable/ignore tests programmatically, and you can even disable tests based off of tags that you can pass in via the maven surefire plugin. Although there's more to disabling tests than that, that is primarily what Bukkit would require.

      I have a test branch up that uses JUnit5. Link

      JUnit5 User Guide: https://junit.org/junit5/docs/current/user-guide/
      JUnit5 Github: https://github.com/junit-team/junit5

            Unassigned Unassigned
            Senmori Senmori
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: