Trait

org.specs2.io

MockFileSystem

Related Doc: package io

Permalink

trait MockFileSystem extends FileSystem

The MockFileSystem trait mocks the FileSystem by storing a Map[path, content] representing the content of the FileSystem

Linear Supertypes
FileSystem, FileWriter, FileReader, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. MockFileSystem
  2. FileSystem
  3. FileWriter
  4. FileReader
  5. AnyRef
  6. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Type Members

  1. case class MockFileWriter(path: String) extends Writer with MockWriter with Product with Serializable

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def addChild(parent: String, child: String): Unit

    Permalink

    adds a new child to a given file

  5. def addFile(path: String, content: String): Unit

    Permalink

    adds a new file to the FileSystem with a specific file path

  6. def addFile(content: String): Unit

    Permalink

    adds a new file to the FileSystem.

    adds a new file to the FileSystem. The file path will be a default one

  7. def append(path: String)(function: (Writer) ⇒ Unit): Unit

    Permalink

    append some content to a file and take care of closing the file.

    append some content to a file and take care of closing the file.

    Usage:

    write("./dir/hello.txt") { out =>
      out.write("content")
    }
    path

    path of the file to write

    Definition Classes
    FileWriter
  8. def appendToFile(path: String, content: ⇒ String): Unit

    Permalink

    writes some content to a file.

    writes some content to a file.

    path

    path of the file to read

    content

    content of the file to write

    Definition Classes
    FileWriter
  9. def appendToXmlFile(path: String, content: ⇒ NodeSeq): Unit

    Permalink

    writes some xml content to a file.

    writes some xml content to a file.

    path

    path of the file to read

    content

    content of the file to write

    Definition Classes
    FileWriter
  10. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  11. def canRead(path: String): Boolean

    Permalink

    overrides the canRead definition checking in the readableFiles list

    overrides the canRead definition checking in the readableFiles list

    returns

    true if the file can be read

    Definition Classes
    MockFileSystem → FileSystem
  12. def canWrite(path: String): Boolean

    Permalink

    overrides the canWrite definition checking in the writableFiles list

    overrides the canWrite definition checking in the writableFiles list

    returns

    true if the file can be written

    Definition Classes
    MockFileSystem → FileSystem
  13. var children: HashMap[String, ListBuffer[String]]

    Permalink

    this map associates some file paths with children paths

  14. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  15. def copy(input: InputStream, output: OutputStream): Unit

    Permalink

    Copy an input stream to an output stream.

    Copy an input stream to an output stream.

    input

    input stream

    output

    output stream

    Definition Classes
    FileSystem
  16. def copyDir(src: String, dest: String): Unit

    Permalink

    copy the content of a directory to another.

    copy the content of a directory to another.

    dest

    destination directory path

    Definition Classes
    FileSystem
  17. def copyFile(path: String, dest: String): Unit

    Permalink

    copy a file to a destination directory

    copy a file to a destination directory

    path

    path of the file to copy

    dest

    destination directory path

    Definition Classes
    FileSystem
  18. def copySpecResourcesDir(base: String, src: String, outputDir: String, loader: ClassLoader): Unit

    Permalink

    Copy specs resources found either in the specs jar or in the classpath directories to an output directory

    Copy specs resources found either in the specs jar or in the classpath directories to an output directory

    base

    path of the base package (must not be empty!)

    src

    name of the resource directory to copy (relative to the base package)

    outputDir

    output directory where to copy the files to

    Definition Classes
    FileSystem
  19. def createDir(path: String): Boolean

    Permalink

    create a new directory

    create a new directory

    Definition Classes
    MockFileSystem → FileSystem
  20. def createFile(path: String): Boolean

    Permalink

    creates a file with the specified path but an empty content

    creates a file with the specified path but an empty content

    Definition Classes
    MockFileSystem → FileWriter
  21. var createdDirs: List[String]

    Permalink

    this list registers created directories

  22. var defaultExtension: String

    Permalink

    default extension which can be used when creating default file names

  23. def defaultFilePath: String

    Permalink

    returns

    a default file path. All default file paths will be different from each other

  24. def delete(path: String): Boolean

    Permalink

    delete a file with the specified path

    delete a file with the specified path

    Definition Classes
    MockFileSystem → FileWriter
  25. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  26. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  27. def exists(path: String): Boolean

    Permalink

    returns

    true if the file exists

    Definition Classes
    MockFileSystem → FileWriter
  28. def filePaths(basePath: String = ".", path: String = "*", verbose: Boolean = false): List[String]

    Permalink

    path

    glob expression, for example: ./dir/**/*.xml

    returns

    all file paths

    Definition Classes
    MockFileSystem → FileSystem
  29. var files: HashMap[String, String]

    Permalink

    this map associates some file paths with file contents

  30. def filterFiles(found: Seq[File], path: String, verbose: Boolean): Seq[String]

    Permalink
    Definition Classes
    FileSystem
  31. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  32. def fromBaseFile(base: File): (File) ⇒ String

    Permalink

    returns

    the path of a File relative to a base file

    Definition Classes
    FileReader
  33. def getAbsolutePath(path: String): String

    Permalink

    returns

    the file absolute path

    Definition Classes
    FileSystem
  34. def getCanonicalPath(path: String): String

    Permalink

    returns

    the file canonical path

    Definition Classes
    FileSystem
  35. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  36. def getName(path: String): String

    Permalink

    returns

    the file name

    Definition Classes
    FileSystem
  37. def getParent(path: String): String

    Permalink

    returns

    the file parent path

    Definition Classes
    FileSystem
  38. def getWriter(path: String, append: Boolean = false): MockFileWriter

    Permalink

    returns

    a mock FileWriter for a specific path

    Definition Classes
    MockFileSystem → FileWriter
  39. def globToPattern(glob: String): String

    Permalink

    returns

    the regular expression equivalent to a glob pattern (see the specs for Fragments)

    Definition Classes
    FileSystem
  40. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  41. def inputStream(filePath: String): InputStream

    Permalink

    returns

    a FileInputStream for a given file path

    Definition Classes
    MockFileSystem → FileReader
  42. def isAbsolute(path: String): Boolean

    Permalink

    overrides the isAbsolute definition checking if it starts with / (partial definition)

    overrides the isAbsolute definition checking if it starts with / (partial definition)

    returns

    true if the file is absolute

    Definition Classes
    MockFileSystem → FileSystem
  43. def isDir(path: String): Boolean

    Permalink

    returns

    true if the File represented by this path is a directory

    Definition Classes
    FileSystem
  44. def isDirectory(path: String): Boolean

    Permalink

    overrides the isDirectory definition checking if it ends with / (partial definition)

    overrides the isDirectory definition checking if it ends with / (partial definition)

    returns

    true if the file is a directory

    Definition Classes
    MockFileSystem → FileSystem
  45. def isFile(path: String): Boolean

    Permalink

    overrides the isFile definition checking if it doesn't end with / (partial definition)

    overrides the isFile definition checking if it doesn't end with / (partial definition)

    returns

    true if the file is a file

    Definition Classes
    MockFileSystem → FileSystem
  46. def isHidden(path: String): Boolean

    Permalink

    overrides the isHidden definition checking if it starts with .

    overrides the isHidden definition checking if it starts with . (partial definition)

    returns

    true if the file is hidden

    Definition Classes
    MockFileSystem → FileSystem
  47. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  48. def listFiles(path: String): List[String]

    Permalink

    overrides the listFiles definition

    overrides the listFiles definition

    returns

    the files of that directory

    Definition Classes
    MockFileSystem → FileSystem
  49. def loadXhtmlFile(filePath: String, report: (Exception, String) ⇒ Unit = defaultLoadXhtmlFileReport, sourceErrors: Boolean = true): NodeSeq

    Permalink

    returns

    the xml content of a file using the Xhtml parser if the file contains several nodes, it wraps them up in a single artificial node

    Definition Classes
    FileReader
  50. def loadXmlFile(filePath: String)(report: (Exception) ⇒ Unit = (e:Exception) => e.printStackTrace): NodeSeq

    Permalink

    returns

    the xml content of a file, using the XML parser

    Definition Classes
    MockFileSystem → FileReader
  51. def md5(f: File): String

    Permalink

    returns

    the MD5 hash of a file

    Definition Classes
    FileReader
  52. def mkdirs(path: String): Boolean

    Permalink

    create a new directory

    create a new directory

    Definition Classes
    MockFileSystem → FileWriter
  53. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  54. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  55. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  56. def readBytes(path: String): Array[Byte]

    Permalink

    returns

    the bytes of a file

    Definition Classes
    FileReader
  57. def readFile(path: String): String

    Permalink

    path

    the path of the file to read

    returns

    the content of a file corresponding to a given path

    Definition Classes
    MockFileSystem → FileReader
  58. def readLines(path: String): IndexedSeq[String]

    Permalink

    returns

    the content of a file corresponding to a given path

    Definition Classes
    MockFileSystem → FileReader
  59. var readableFiles: List[String]

    Permalink

    this list stores readable files

  60. def removeDir(path: String): String

    Permalink

    deletes the directory and all directory content at the specified path and return the parent path of that directory

    deletes the directory and all directory content at the specified path and return the parent path of that directory

    Definition Classes
    FileSystem
  61. def reset: MockFileSystem.this.type

    Permalink

    removes all specified files

  62. def samePath(p1: String, p2: String): Boolean

    Permalink

    returns

    true if 2 paths are the same according to their canonical representation

    Definition Classes
    FileSystem
  63. def setNotReadable(path: String): String

    Permalink

    sets a file as not readable

  64. def setNotWritable(path: String): String

    Permalink

    sets a file as not writable

  65. def setReadable(path: String): String

    Permalink

    sets a file as readable

  66. def setWritable(path: String): String

    Permalink

    sets a file as writable

  67. def silentLoadXhtmlFileReport: (Exception, String) ⇒ Unit

    Permalink
    Definition Classes
    FileReader
  68. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  69. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  70. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  71. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  72. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  73. var writableFiles: List[String]

    Permalink

    this list stores writable files

  74. def write(path: String)(function: (Writer) ⇒ Unit): Unit

    Permalink

    writes some content to a file and take care of closing the file.

    writes some content to a file and take care of closing the file.

    Usage:

    write("./dir/hello.txt") { out =>
      out.write("content")
    }
    path

    path of the file to write

    Definition Classes
    FileWriter
  75. def writeFile(path: String, content: ⇒ String): Unit

    Permalink

    writes some content to a file.

    writes some content to a file.

    path

    path of the file to read

    content

    content of the file to write

    Definition Classes
    FileWriter
  76. def writeXmlFile(path: String, content: ⇒ NodeSeq): Unit

    Permalink

    writes some xml content to a file.

    writes some xml content to a file.

    path

    path of the file to read

    content

    content of the file to write

    Definition Classes
    FileWriter

Inherited from FileSystem

Inherited from FileWriter

Inherited from FileReader

Inherited from AnyRef

Inherited from Any

Ungrouped