public static File createTmpFile(String nameHint, TMP_FILE_PRESERVE_MODE preserveMode) {
        try {
            File tmpFile = File.createTempFile(nameHint, ".tmp");
            Assertions.assertTrue(tmpFile.isAbsolute(), "The created temporary file " + tmpFile + " is not absolute!");
            if (preserveMode != null) {
                switch (preserveMode) {
                    case DELETE_IMMEDIATELY:
                        Assertions.assertTrue(tmpFile.delete(), "Unable to delete temporary file " + tmpFile);
                        break;
                    case DELETE_ON_EXIT:
                        tmpFile.deleteOnExit();
                        break;
                    // PRESERVE is a no-op
                }
            } else {
                // default when preserveMode is null
                tmpFile.deleteOnExit();
            }
            return tmpFile.getCanonicalFile();
        } catch (IOException e) {
            throw new RuntimeException("Unable to create or canonicalize temporary directory");
        }
    }
Creates a unique file under {@code java.io.tmpdir} and returns the {@link File#getCanonicalFile() canonical}
{@code File}.  The optional {@code preserveMode} parameter dictates who is responsible for deleting the created
file, and when.  This methodology
<ol>
  <li>guarantees a unique file name,</li>
  <li>doesn't clutter the filesystem with test-related directories or files,</li>
  <li>returns an absolute path (important for relative volume binding strings),
  <li>and returns a canonical file name.</li>
</ol>

@param nameHint a string used to help create the temporary file name, may be {@code null}
@param preserveMode mechanism for handling the clean up of files created by this method, may be {@code null}
which is equivalent to {@link TMP_FILE_PRESERVE_MODE#DELETE_ON_EXIT}
@return the absolute temporary file, which may not exist depending on the {@code preserveMode}
src/test/java/io/fabric8/maven/docker/util/PathTestUtil.java