SamzaRestService { public void stop() throws Exception { metricsReporters.forEach((reporterName, metricsReporter) -> { log.info("Stopping the metrics reporter : {}.", reporterName); metricsReporter.stop(); }); log.info("Stopping server"); server.stop(); log.info("Server is stopped"); } SamzaRestService(Server server,
      ReadableMetricsRegistry metricsRegistry,
      Map<String, MetricsReporter> metricsReporters,
      ServletContextHandler context); static void main(String[] args); void addServlet(Servlet servlet, String path); void start(); void stop();  }
@Test public void testStopShouldStopTheMetricsReportersAndStopTheServer() throws Exception { samzaRestService.stop(); Mockito.verify(metricsReporter).stop(); Mockito.verify(server).stop(); }