Package net.andreinc.mockneat.unit.text
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
-
-
Field Summary
-
Fields inherited from class net.andreinc.mockneat.abstraction.MockUnitBase
mockNeat
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappend(java.lang.String filePath, int numberOfLines)Appends to a csv file If the specified location is not available for writing an UncheckedIOException is thrown.voidappend(java.nio.file.Path path, int numberOfLines)CSVscolumn(java.lang.Object value)Add a new column to resulting CVS line with a constant value.CSVscolumn(MockUnit<?> mockUnit)Add a new column to the resulting csv line.static CSVscsvs()Returns aCSVsobject that can be used to generate CSV lines or files.CSVsseparator(java.lang.String separator)java.util.function.Supplier<java.lang.String>supplier()This is the sole abstract method of the interface.voidwrite(java.lang.String filePath, int numberOfLines)Writes a csv file.voidwrite(java.lang.String filePath, int numberOfLines, boolean append)Writes a csv file.voidwrite(java.nio.file.Path path, int numberOfLines)voidwrite(java.nio.file.Path path, int numberOfLines, boolean append)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.andreinc.mockneat.abstraction.MockUnit
array, array, collection, collection, collection, collection, collection, collection, consume, consume, get, get, list, list, list, list, list, list, map, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapToDouble, mapToInt, mapToLocalDate, mapToLong, mapToString, mapToString, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, serialize, set, set, set, set, set, set, stream, val, val, valStr, valStr
-
Methods inherited from interface net.andreinc.mockneat.abstraction.MockUnitString
accumulate, append, array, base64, escapeCsv, escapeEcmaScript, escapeHtml, escapeXml, format, md2, md5, noSpecialChars, prepend, replace, replace, replaceAll, replaceFirst, sha1, sha256, sha384, sha512, split, split, sub, sub, urlEncode, urlEncode
-
-
-
-
Constructor Detail
-
CSVs
protected CSVs()
-
CSVs
public CSVs(MockNeat mockNeat)
-
-
Method Detail
-
csvs
public static CSVs csvs()
Returns a
CSVsobject 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:MockUnitThis is the sole abstract method of the interface. Needs to be implemented every-time a MockUnit is implemented.
-
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 writtennumberOfLines- 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 writtennumberOfLines- The number of files to be contained in the csv fileappend- 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 writtennumberOfLines- The number of files to be contained in the csv file
-
append
public void append(java.nio.file.Path path, int numberOfLines)
-
-