Interface DateProvider


  • public interface DateProvider
    Provides abstraction over @{link Date#Date()}, to allow code to swap out calls to system date by a fake date in tests to create reliable tests.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static DateProvider SYSTEM
      Implementation that calls to the real @{link Date#Date()}.
    • Field Detail

      • SYSTEM

        static final DateProvider SYSTEM
        Implementation that calls to the real @{link Date#Date()}. This should never be called through directly in code. The right pattern is to create a variable and assign that variable to SYSTEM upon initialization and override the variable in tests.
    • Method Detail

      • now

        java.util.Date now()
        Provides this DataProvider's notion of 'now'.