You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To reduce time required for test runs application context is reused sometimes in different tests.
It is highly relevant for integration tests.
By "application context" here could be considered Spring-context.
It's suggested to introduce "reset" method to metrics to be able to start from scratch in a particular test case if it's needed.
Also it makes sense to add such method on MetricRegistry level (moreover, maybe it's enough - no need to add for each Metric type).
For example
MetricRegistry registry = new DefaultMetricRegistry();
Counter counter = registry.counter(withName("counter"));
counter.inc();
counter.inc();
counter.forEach(instance -> {
Long v = (Long)instance.valueOf(COUNT);
// Current value: 2
System.out.println("Current value: " + v);
});
counter.reset();
// or
registry.resetMetrics();
// Current value: 0
System.out.println("Current value: " + v);
The text was updated successfully, but these errors were encountered:
To reduce time required for test runs application context is reused sometimes in different tests.
It is highly relevant for integration tests.
By "application context" here could be considered Spring-context.
It's suggested to introduce "reset" method to metrics to be able to start from scratch in a particular test case if it's needed.
Also it makes sense to add such method on MetricRegistry level (moreover, maybe it's enough - no need to add for each Metric type).
For example
The text was updated successfully, but these errors were encountered: