### Question:
FlumeStatsRestSourceHandler implements RestSourceHandler { @Override @SuppressWarnings("unchecked") public List<Event> getEvents(final String body, final Map<String, String> httpHeaders) { final List<Event> events = new ArrayList<Event>(0); try { ObjectMapper mapper = new ObjectMapper(); @SuppressWarnings("unchecked") Map<String, Object> map = (Map<String, Object>)mapper.readValue(body, Map.class); for (Map.Entry<String, Object> entry : map.entrySet()) { final Map<String, String> headers = new HashMap<String, String>(); final String key = entry.getKey(); final String name = key.substring(key.indexOf(".") + 1, key.length()); headers.put("Name", name); for (Map.Entry<String, Object> componentInfo : ((Map<String,Object>)entry.getValue()).entrySet()) { headers.put(componentInfo.getKey(), componentInfo.getValue().toString()); } final Event event = new JSONEvent(); event.setHeaders(headers); event.setBody("".getBytes()); events.add(event); } } catch (IOException ex) { throw new RestSourceException(ex); } catch (ClassCastException ex) { throw new RestSourceException(ex); } return events; }  @Override void configure(Context context); @Override @SuppressWarnings("unchecked") List<Event> getEvents(final String body, final Map<String, String> httpHeaders);  }### Answer:
@Test public void getEvents() throws Exception { final String response = "{\n" + "\"CHANNEL.fileChannel\":{\"EventPutSuccessCount\":\"468085\",\n" + " \"Type\":\"CHANNEL\"},\n" + "\"CHANNEL.memChannel\":{\"EventPutSuccessCount\":\"22948908\",\n" + " \"Type\":\"CHANNEL\"}" + "}"; final List<Event> events = handler.getEvents(response, ImmutableMap.<String,String>of()); assertThat(events).isNotEmpty().hasSize(2); final Map<String,String> e1 = events.get(0).getHeaders(); final Map<String,String> e2 = events.get(1).getHeaders(); assertThat(e1).isEqualTo(ImmutableMap.of("Name", "fileChannel", "Type", "CHANNEL", "EventPutSuccessCount", "468085")); assertThat(e2).isEqualTo(ImmutableMap.of("Name", "memChannel", "Type", "CHANNEL", "EventPutSuccessCount", "22948908")); }