Package uk.co.evoco.testdata
Class Dates
- java.lang.Object
-
- net.andreinc.mockneat.abstraction.MockUnitBase
-
- uk.co.evoco.testdata.Dates
-
public class Dates extends net.andreinc.mockneat.abstraction.MockUnitBase
-
-
Constructor Summary
Constructors Constructor Description Dates()
-
Method Summary
Modifier and Type Method Description static String
futureDataAvoidingWeekendsAndBankHolidays(Locale locale, String startDate, int numberOfBusinessDaysToAdd, String dateFormat)
static String
futureDate(String startDate, int daysToAdd, String dateFormat)
Returns a string that represents the date that is the given days ahead of the start datestatic String
futureDateAvoidingWeekends(String startDate, int numberOfBusinessDaysToAdd, String dateFormat)
static String
now(String dateFormat)
Returns the current date for todaystatic String
pastDate(String startDate, int daysToRemove, String dateFormat)
Returns a string that represents the date that is the given days behind of the start date
-
-
-
Method Detail
-
futureDate
public static String futureDate(String startDate, int daysToAdd, String dateFormat)
Returns a string that represents the date that is the given days ahead of the start date- Parameters:
startDate
- start datedaysToAdd
- days to add to start datedateFormat
- date format (e.g. "dd/MM/yyyy","dd/MM/yyyy HH:mm")- Returns:
- String representing resulting date
-
pastDate
public static String pastDate(String startDate, int daysToRemove, String dateFormat)
Returns a string that represents the date that is the given days behind of the start date- Parameters:
startDate
- start datedaysToRemove
- days to remove from start datedateFormat
- date format (e.g. "dd/MM/yyyy","dd/MM/yyyy HH:mm")- Returns:
- String representing resulting date
-
now
public static String now(String dateFormat)
Returns the current date for today- Parameters:
dateFormat
- date format (e.g. "dd/MM/yyyy","dd/MM/yyyy HH:mm")- Returns:
- String representing resulting date
-
futureDateAvoidingWeekends
public static String futureDateAvoidingWeekends(String startDate, int numberOfBusinessDaysToAdd, String dateFormat)
- Parameters:
startDate
- the date to start withnumberOfBusinessDaysToAdd
- Days to add, avoiding weekendsdateFormat
- date format (e.g. "dd/MM/yyyy","dd/MM/yyyy HH:mm"")- Returns:
- String representing resulting date
-
futureDataAvoidingWeekendsAndBankHolidays
public static String futureDataAvoidingWeekendsAndBankHolidays(Locale locale, String startDate, int numberOfBusinessDaysToAdd, String dateFormat) throws IOException
- Parameters:
locale
- the location for UK bank holidays (see @link Dates)startDate
- the date to start withnumberOfBusinessDaysToAdd
- Days to add, avoiding weekends and UK bank holidaysdateFormat
- date format (e.g. "dd/MM/yyyy","dd/MM/yyyy HH:mm")- Returns:
- String representing resulting date
- Throws:
IOException
- if the JSON source for bank holidays cannot be read
-
-