@Test
    public void metrics_are_retrieved_upon_first_update() throws InterruptedException, ExecutionException {
        assertEquals(0, nodeMetricsClient.getMetrics(defaultMetricsConsumerId).size());
        assertEquals(0, nodeMetricsClient.snapshotsRetrieved());
        updateSnapshot(defaultMetricsConsumerId, TTL);
        assertEquals(1, nodeMetricsClient.snapshotsRetrieved());
        List<MetricsPacket> metrics = nodeMetricsClient.getMetrics(defaultMetricsConsumerId);
        assertEquals(1, nodeMetricsClient.snapshotsRetrieved());
        assertEquals(4, metrics.size());
   }
Two optimizations worth noting:
<p>
1. Using a ClassRule for the wire mocking means it is reused between test methods.
2. Configuring stubs on the rule is faster than using the static WireMock.stubFor method.

@author gjoranv
metrics-proxy/src/test/java/ai/vespa/metricsproxy/http/application/NodeMetricsClientTest.java