@VisibleForTesting
    int getPort() {
        Preconditions.checkState(httpServer != null, "Server has not been initialized.");
        return port;
    }
@Test
    void metricIsRemovedWhileOtherMetricsWithSameNameExist() throws UnirestException {
        String metricName = "metric";

        Counter metric1 = new SimpleCounter();
        Counter metric2 = new SimpleCounter();

        final Map<String, String> variables2 = new HashMap<>(metricGroup.getAllVariables());
        final Map.Entry<String, String> entryToModify = variables2.entrySet().iterator().next();
        final String labelValueThatShouldBeRemoved = entryToModify.getValue();
        variables2.put(entryToModify.getKey(), "some_value");
        final MetricGroup metricGroup2 = TestUtils.createTestMetricGroup(LOGICAL_SCOPE, variables2);

        reporter.notifyOfAddedMetric(metric1, metricName, metricGroup);
        reporter.notifyOfAddedMetric(metric2, metricName, metricGroup2);
        reporter.notifyOfRemovedMetric(metric1, metricName, metricGroup);

        String response = pollMetrics(reporter.getPort()).getBody();

        assertThat(response).contains("some_value").doesNotContain(labelValueThatShouldBeRemoved);
    }