Skip to content

Instantly share code, notes, and snippets.

@mgryszko
Last active October 20, 2020 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgryszko/88c86182c0c085f7b99bd1d0075a6f29 to your computer and use it in GitHub Desktop.
Save mgryszko/88c86182c0c085f7b99bd1d0075a6f29 to your computer and use it in GitHub Desktop.
class MeteredCacheTest {
Meter gets = new Meter();
Meter puts = new Meter();
Meter hits = new Meter();
MetricRegistry metrics = new MetricRegistry();
Cache delegate = mock<Cache>();
Cache cache = new MeteredCache(delegate, metrics);
@Test
void getAndPut() {
registerMetrics();
// test cache and check generated metrics
}
void registerMetrics() {
metrics.register("gets", puts);
metrics.register("puts", puts);
metrics.register("hits", hits);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment