Class CSVs

java.lang.Object
net.andreinc.mockneat.abstraction.MockUnitBase
net.andreinc.mockneat.unit.text.CSVs
All Implemented Interfaces:
MockUnit<java.lang.String>, MockUnitString

public class CSVs
extends MockUnitBase
implements MockUnitString
  • Constructor Details

  • Method Details

    • csvs

      public static CSVs csvs()

      Returns a CSVs object that can be used to generate CSV lines or files.

      Returns:
      A new CSVs object.
    • separator

      public CSVs separator​(java.lang.String separator)
    • column

      public CSVs column​(MockUnit<?> mockUnit)
      Add a new column to the resulting csv line. Internally the supplied mockUnit is transformed to a MockUnitString and afterwards the `escapeCsvMethod()` is called. Order is kept.
      Parameters:
      mockUnit - The supplied mockUnit
      Returns:
      (same object)
    • column

      public CSVs column​(java.lang.Object value)
      Add a new column to resulting CVS line with a constant value. The toString() method of the supplied object is invoked. Order is kept.
      Parameters:
      value - The constant value used
      Returns:
      (same object)
    • supplier

      public java.util.function.Supplier<java.lang.String> supplier()
      Description copied from interface: MockUnit
      This is the sole abstract method of the interface. Needs to be implemented every-time a MockUnit is implemented.
      Specified by:
      supplier in interface MockUnit<java.lang.String>
      Returns:
      A Supplier<T>.
    • write

      public void write​(java.lang.String filePath, int numberOfLines)
      Writes a csv file. If the specified location is not available for writing an UncheckedIOException is thrown.
      Parameters:
      filePath - The path were the csv content is written
      numberOfLines - The number of files to be contained in the csv file
    • write

      public void write​(java.nio.file.Path path, int numberOfLines)
    • write

      public void write​(java.lang.String filePath, int numberOfLines, boolean append)
      Writes a csv file. If the specified location is not available for writing an UncheckedIOException is thrown.
      Parameters:
      filePath - The path were the csv content is written
      numberOfLines - The number of files to be contained in the csv file
      append - If true the lines are appended.
    • write

      public void write​(java.nio.file.Path path, int numberOfLines, boolean append)
    • append

      public void append​(java.lang.String filePath, int numberOfLines)
      Appends to a csv file If the specified location is not available for writing an UncheckedIOException is thrown.
      Parameters:
      filePath - The path were the csv content is written
      numberOfLines - The number of files to be contained in the csv file
    • append

      public void append​(java.nio.file.Path path, int numberOfLines)