Annotation Type TimeMachine


  • @Documented
    @Target({METHOD,CONSTRUCTOR})
    @Retention(RUNTIME)
    public @interface TimeMachine
    For time specific tests you can use this annotation to set the todays date.
    Since:
    1.6 (06.09.2015)
    Version:
    $Revision: 1.3 $
    Author:
    oliver
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      java.lang.String today
      You need a specific day for your unit test?
    • Element Detail

      • today

        java.lang.String today
        You need a specific day for your unit test? Use this annotation together with the TimeMachineAspect, to set it. Each call of the normal Date constructur will create a Date with this day as the current date.

        The format of the date is "dd-MMM-yyyy" or "dd-MMM-yyyy H:mm".

        NOTE: For a successful work of the TimeMachineAspect ony methods which are not called via reflexion work as expected. Because JUnit tests are called via reflexion extract your test method in an extra method "subTestMethod" and mark this "subTestMethod" with "@TimeMachine".

        Returns:
        the string
        Default:
        ""