Class Dates

java.lang.Object
net.andreinc.mockneat.abstraction.MockUnitBase
uk.co.evoco.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 
    Constructor Description
    Dates()  
  • Method Summary

    Modifier and Type Method Description
    static java.lang.String futureDataAvoidingWeekendsAndBankHolidays​(Locale locale, java.lang.String startDate, int numberOfBusinessDaysToAdd, java.lang.String dateFormat)  
    static java.lang.String futureDate​(java.lang.String startDate, int daysToAdd, java.lang.String dateFormat)
    Returns a string that represents the date that is the given days ahead of the start date
    static java.lang.String futureDateAvoidingWeekends​(java.lang.String startDate, int numberOfBusinessDaysToAdd, java.lang.String dateFormat)  
    static java.lang.String now​(java.lang.String dateFormat)
    Returns the current date for today
    static java.lang.String pastDate​(java.lang.String startDate, int daysToRemove, java.lang.String dateFormat)
    Returns a string that represents the date that is the given days behind of the start date

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • futureDate

      public static java.lang.String futureDate​(java.lang.String startDate, int daysToAdd, java.lang.String dateFormat)
      Returns a string that represents the date that is the given days ahead of the start date
      Parameters:
      startDate - start date
      daysToAdd - days to add to start date
      dateFormat - date format (e.g. "dd/MM/yyyy","dd/MM/yyyy HH:mm")
      Returns:
      String representing resulting date
    • pastDate

      public static java.lang.String pastDate​(java.lang.String startDate, int daysToRemove, java.lang.String dateFormat)
      Returns a string that represents the date that is the given days behind of the start date
      Parameters:
      startDate - start date
      daysToRemove - days to remove from start date
      dateFormat - date format (e.g. "dd/MM/yyyy","dd/MM/yyyy HH:mm")
      Returns:
      String representing resulting date
    • now

      public static java.lang.String now​(java.lang.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 java.lang.String futureDateAvoidingWeekends​(java.lang.String startDate, int numberOfBusinessDaysToAdd, java.lang.String dateFormat)
      Parameters:
      startDate - the date to start with
      numberOfBusinessDaysToAdd - Days to add, avoiding weekends
      dateFormat - date format (e.g. "dd/MM/yyyy","dd/MM/yyyy HH:mm"")
      Returns:
      String representing resulting date
    • futureDataAvoidingWeekendsAndBankHolidays

      public static java.lang.String futureDataAvoidingWeekendsAndBankHolidays​(Locale locale, java.lang.String startDate, int numberOfBusinessDaysToAdd, java.lang.String dateFormat) throws java.io.IOException
      Parameters:
      locale - the location for UK bank holidays (see @link Dates)
      startDate - the date to start with
      numberOfBusinessDaysToAdd - Days to add, avoiding weekends and UK bank holidays
      dateFormat - date format (e.g. "dd/MM/yyyy","dd/MM/yyyy HH:mm")
      Returns:
      String representing resulting date
      Throws:
      java.io.IOException - if the JSON source for bank holidays cannot be read