### Question:
DefaultRestSourceHandler implements RestSourceHandler { @Override public List<Event> getEvents(String body, Map<String, String> headers) { List<Event> events = new ArrayList<Event>(0); events.add(EventBuilder.withBody(body, Charsets.UTF_8, headers)); return events; } DefaultRestSourceHandler(); @Override List<Event> getEvents(String body, Map<String, String> headers); @Override void configure(Context context);  }### Answer:
@Test public void getEventsWithEmptyBodyAndEmptyHeaders() { final List<Event> events = handler.getEvents("", new ImmutableMap.Builder<String, String>().build()); Assertions.assertThat(events).isNotNull(); }
@Test public void getEventsWithBodyAndHeaders() throws Exception { final ImmutableMap<String, String> headersMap = new ImmutableMap.Builder<String, String>().put ("header1", "value1").put ("header2", "value2").build(); final List<Event> events = handler.getEvents("body", headersMap); Assertions.assertThat(events).isNotNull(); Assertions.assertThat(events.get(0).getBody()).isEqualTo("body".getBytes()); Assertions.assertThat(events.get(0).getHeaders()).isEqualTo(headersMap); }
@Test public void getEventsWithBodyAndHeadersAndPath() throws Exception { final ImmutableMap<String, String> headersMap = new ImmutableMap.Builder<String, String>().put ("header1", "value1").put ("header2", "value2").build(); final List<Event> events = handler.getEvents("body", headersMap); Assertions.assertThat(events).isNotNull(); Assertions.assertThat(events.get(0).getBody()).isEqualTo("body".getBytes()); Assertions.assertThat(events.get(0).getHeaders()).isEqualTo(headersMap); }