Class PollingAwareMockStepClock
java.lang.Object
io.micrometer.core.instrument.step.PollingAwareMockStepClock
- All Implemented Interfaces:
io.micrometer.core.instrument.Clock
@Incubating(since="1.11.1")
public class PollingAwareMockStepClock
extends Object
implements io.micrometer.core.instrument.Clock
A clock meant to be used for testing
StepMeterRegistry. This clock does the
StepMeterRegistry.pollMetersToRollover() whenever the step is crossed thus
simulating the expected behaviour of step meters.- Since:
- 1.11.1
-
Field Summary
Fields inherited from interface io.micrometer.core.instrument.Clock
SYSTEM -
Constructor Summary
ConstructorsConstructorDescriptionPollingAwareMockStepClock(io.micrometer.core.instrument.step.StepRegistryConfig stepRegistryConfig) -
Method Summary
Modifier and TypeMethodDescriptionlongAdvances clock by the duration specified and doesStepMeterRegistry.pollMetersToRollover()if necessary.longlongwallTime()
-
Constructor Details
-
PollingAwareMockStepClock
public PollingAwareMockStepClock(io.micrometer.core.instrument.step.StepRegistryConfig stepRegistryConfig)
-
-
Method Details
-
wallTime
public long wallTime()- Specified by:
wallTimein interfaceio.micrometer.core.instrument.Clock
-
monotonicTime
public long monotonicTime()- Specified by:
monotonicTimein interfaceio.micrometer.core.instrument.Clock
-
add
public long add(Duration duration, io.micrometer.core.instrument.step.StepMeterRegistry stepMeterRegistry) Advances clock by the duration specified and doesStepMeterRegistry.pollMetersToRollover()if necessary.- Parameters:
duration- amount to increment bystepMeterRegistry-StepMeterRegistryto which clock is tied- Returns:
- current time after adding step
-