### Question:
MetricsProcessor extends ApiDataListener { private MetricsProcessor() { } private  MetricsProcessor(); int addContext(); static MetricsProcessor getInstance(); @Override void processData(List<String> jsonData); boolean removeContext(int id); MetricsData getMetricsData(int id); boolean resetMetricsData(int id); Integer[] getContextIds(); String getEnvironment();  }### Answer:
@Test public void testMetricsProcessor() { Javametrics.getInstance().addListener(mp); int id = mp.addContext(); try { Thread.sleep(3000); } catch (InterruptedException e) { } List<String> jsonData = new ArrayList<String>(); jsonData.add("{\"topic\":\"http\",\"payload\":{\"time\":" + System.currentTimeMillis() + ",\"duration\":150,\"url\":\"http: jsonData.add("{\"topic\":\"http\",\"payload\":{\"time\":" + System.currentTimeMillis() + ",\"duration\":150,\"url\":\"http: jsonData.add("{\"topic\":\"http\",\"payload\":{\"time\":" + System.currentTimeMillis() + ",\"duration\":600,\"url\":\"http: mp.processData(jsonData); jsonData.clear(); try { Thread.sleep(3000); } catch (InterruptedException e) { } int id2 = mp.addContext(); jsonData.add("{\"topic\":\"http\",\"payload\":{\"time\":" + System.currentTimeMillis() + ",\"duration\":150,\"url\":\"http: jsonData.add("{\"topic\":\"http\",\"payload\":{\"time\":" + System.currentTimeMillis() + ",\"duration\":0,\"url\":\"http: printSummary(id); jsonData.add("{\"topic\":\"http\",\"payload\":{\"time\":" + System.currentTimeMillis() + ",\"duration\":150,\"url\":\"http: mp.processData(jsonData); try { Thread.sleep(3000); } catch (InterruptedException e) { } System.gc(); try { Thread.sleep(3000); } catch (InterruptedException e) { } printSummary(id); printSummary(id2); }