Class MockTimeService
java.lang.Object
de.hybris.platform.personalizationservices.stub.MockTimeService
- All Implemented Interfaces:
TimeService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the adjusted current time relative to the time set byTimeService.setCurrentTime(Date)with time part normalized to 0.Returns the adjusted current time relative to the time set byTimeService.setCurrentTime(Date).longReturns the time offset in milliseconds, which is the time difference between the system time whenTimeService.setCurrentTime(Date)is called and the argument passed to theTimeService.setCurrentTime(Date)voidReset the time back to system time.voidsetCurrentTime(Date instant) Set the current time to the specified time instant.voidsetTimeOffset(long timeOffsetMillis) Set the time offset in milliseconds.
-
Constructor Details
-
MockTimeService
public MockTimeService() -
MockTimeService
-
-
Method Details
-
setCurrentTime
Description copied from interface:TimeServiceSet the current time to the specified time instant.- Specified by:
setCurrentTimein interfaceTimeService
-
getCurrentTime
Description copied from interface:TimeServiceReturns the adjusted current time relative to the time set byTimeService.setCurrentTime(Date). IfTimeService.setCurrentTime(Date)was never called earlier, then current system time is returned.- Specified by:
getCurrentTimein interfaceTimeService
-
getTimeOffset
public long getTimeOffset()Description copied from interface:TimeServiceReturns the time offset in milliseconds, which is the time difference between the system time whenTimeService.setCurrentTime(Date)is called and the argument passed to theTimeService.setCurrentTime(Date)- Specified by:
getTimeOffsetin interfaceTimeService
-
resetTimeOffset
public void resetTimeOffset()Description copied from interface:TimeServiceReset the time back to system time. CallingTimeService.getTimeOffset()after calling this method will get a value of 0. This is equivalent to callingTimeService.setTimeOffset(long)with a zero value argument.- Specified by:
resetTimeOffsetin interfaceTimeService
-
setTimeOffset
public void setTimeOffset(long timeOffsetMillis) Description copied from interface:TimeServiceSet the time offset in milliseconds. Subsequent call toTimeService.getCurrentTime()will return the system time plus the offset.- Specified by:
setTimeOffsetin interfaceTimeService- Parameters:
timeOffsetMillis- time offset in milliseconds. Use a negative value to adjust time backwards.
-
getCurrentDateWithTimeNormalized
Description copied from interface:TimeServiceReturns the adjusted current time relative to the time set byTimeService.setCurrentTime(Date)with time part normalized to 0. IfTimeService.setCurrentTime(Date)was never called earlier, then current system time is returned.- Specified by:
getCurrentDateWithTimeNormalizedin interfaceTimeService
-