Enum Class CleanupMode

java.lang.Object
java.lang.Enum<CleanupMode>
org.junit.jupiter.api.io.CleanupMode
All Implemented Interfaces:
Serializable, Comparable<CleanupMode>, Constable

@API(status=STABLE, since="5.11") public enum CleanupMode extends Enum<CleanupMode>
Enumeration of cleanup modes for @TempDir.

When a test with a temporary directory completes, it might be useful in some cases to be able to view the contents of the temporary directory used by the test. CleanupMode allows you to control how a TempDir is cleaned up.

Since:
5.9
See Also:
  • Enum Constant Details

    • DEFAULT

      public static final CleanupMode DEFAULT
      Use the default cleanup mode.
      See Also:
    • ALWAYS

      public static final CleanupMode ALWAYS
      Always clean up a temporary directory after the test has completed.
    • ON_SUCCESS

      public static final CleanupMode ON_SUCCESS
      Only clean up a temporary directory if the test completed successfully.
    • NEVER

      public static final CleanupMode NEVER
      Never clean up a temporary directory after the test has completed.
  • Method Details

    • values

      public static CleanupMode[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static CleanupMode valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null