public class TestUtils extends Object
| Constructor and Description |
|---|
TestUtils() |
| Modifier and Type | Method and Description |
|---|---|
static String |
csvToJsonArray(String csv,
String fieldSeparator)
Turns a csv with a header row into a JSON array.
|
static String |
currentTimeString()
Returns the current time as a String formatted as needed.
|
static String |
getTimeString(Calendar cal)
Returns the time given by
cal as a String formatted as needed. |
static Calendar |
parseTime(String timestring)
Returns a calendar for the given time string.
|
static String |
relativeTimeString(int days)
Returns the current time + days as a String formatted as needed.
|
static String |
wrapJsonIntoObject(String jsonString,
String object)
Wraps a JSON String into a JSON object.
|
public static String currentTimeString()
public static String relativeTimeString(int days)
days - the number of days relative to nowpublic static String getTimeString(Calendar cal)
cal as a String formatted as needed.cal - the time to formatpublic static String wrapJsonIntoObject(String jsonString, String object)
str and the JSON object obj the resulting
JSON String would be: {"obj":str}.jsonString - the JSON String to wrapobject - the object to wrap intopublic static String csvToJsonArray(String csv, String fieldSeparator)
csv - the csv stringfieldSeparator - the column separatorspublic static Calendar parseTime(String timestring) throws ParseException
yyyy-MM-dd'T'hh:mm:ssZ, where Z is a literal (and stands for +0000).
It is assumed to be in UTC.timestring - the time stringParseException - if the time string is not correctly formatted.Copyright © 2016. All rights reserved.