Package com.version1.testdata
Class Dates
java.lang.Object
net.andreinc.mockneat.abstraction.MockUnitBase
com.version1.testdata.Dates
public class Dates
extends net.andreinc.mockneat.abstraction.MockUnitBase
-
Field Summary
Fields inherited from class net.andreinc.mockneat.abstraction.MockUnitBase
mockNeat -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringfutureDataAvoidingWeekendsAndBankHolidays(Locale locale, String startDate, int numberOfBusinessDaysToAdd, String dateFormat) static StringfutureDate(String startDate, int daysToAdd, String dateFormat) Returns a string that represents the date that is the given days ahead of the start datestatic StringfutureDateAvoidingWeekends(String startDate, int numberOfBusinessDaysToAdd, String dateFormat) static booleanisDateWithinTolerance(String dateFormat, String baseDate, String comparisonDate, long toleranceInMinutes) Returns boolean result on if the two given dates are within the given tolerancestatic StringReturns the current date for todaystatic StringReturns a string that represents the date that is the given days behind of the start date
-
Constructor Details
-
Dates
public Dates()
-
-
Method Details
-
futureDate
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
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
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
-
isDateWithinTolerance
public static boolean isDateWithinTolerance(String dateFormat, String baseDate, String comparisonDate, long toleranceInMinutes) Returns boolean result on if the two given dates are within the given tolerance- Parameters:
dateFormat-baseDate-comparisonDate-toleranceInMinutes-- Returns:
-
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
-