Class TempDirectory.CloseablePath

  • All Implemented Interfaces:
    java.lang.AutoCloseable, org.junit.jupiter.api.extension.ExtensionContext.Store.CloseableResource
    Enclosing class:
    TempDirectory

    static class TempDirectory.CloseablePath
    extends java.lang.Object
    implements org.junit.jupiter.api.extension.ExtensionContext.Store.CloseableResource, java.lang.AutoCloseable
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.reflect.AnnotatedElement annotatedElement  
      private org.junit.jupiter.api.io.CleanupMode cleanupMode  
      private java.nio.file.Path dir  
      private org.junit.jupiter.api.extension.ExtensionContext extensionContext  
      private org.junit.jupiter.api.io.TempDirFactory factory  
      private static org.junit.platform.commons.logging.Logger LOGGER  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private CloseablePath​(org.junit.jupiter.api.io.TempDirFactory factory, org.junit.jupiter.api.io.CleanupMode cleanupMode, java.lang.Class<?> elementType, org.junit.jupiter.api.extension.AnnotatedElementContext elementContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)  
    • Field Detail

      • LOGGER

        private static final org.junit.platform.commons.logging.Logger LOGGER
      • dir

        private final java.nio.file.Path dir
      • factory

        private final org.junit.jupiter.api.io.TempDirFactory factory
      • cleanupMode

        private final org.junit.jupiter.api.io.CleanupMode cleanupMode
      • annotatedElement

        private final java.lang.reflect.AnnotatedElement annotatedElement
      • extensionContext

        private final org.junit.jupiter.api.extension.ExtensionContext extensionContext
    • Constructor Detail

      • CloseablePath

        private CloseablePath​(org.junit.jupiter.api.io.TempDirFactory factory,
                              org.junit.jupiter.api.io.CleanupMode cleanupMode,
                              java.lang.Class<?> elementType,
                              org.junit.jupiter.api.extension.AnnotatedElementContext elementContext,
                              org.junit.jupiter.api.extension.ExtensionContext extensionContext)
                       throws java.lang.Exception
        Throws:
        java.lang.Exception
    • Method Detail

      • get

        java.nio.file.Path get()
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface org.junit.jupiter.api.extension.ExtensionContext.Store.CloseableResource
        Throws:
        java.io.IOException
      • descriptionFor

        private static java.lang.String descriptionFor​(java.lang.reflect.AnnotatedElement annotatedElement)
        Since:
        5.12
      • descriptionFor

        private static java.lang.String descriptionFor​(java.lang.reflect.Executable executable)
        Since:
        5.12
      • deleteAllFilesAndDirectories

        private java.util.SortedMap<java.nio.file.Path,​java.io.IOException> deleteAllFilesAndDirectories​(TempDirectory.FileOperations fileOperations)
                                                                                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • tryToResetPermissions

        private static void tryToResetPermissions​(java.nio.file.Path path)
      • createIOExceptionWithAttachedFailures

        private java.io.IOException createIOExceptionWithAttachedFailures​(java.util.SortedMap<java.nio.file.Path,​java.io.IOException> failures)
      • tryToDeleteOnExit

        private java.nio.file.Path tryToDeleteOnExit​(java.nio.file.Path path)
      • relativizeSafely

        private java.nio.file.Path relativizeSafely​(java.nio.file.Path path)