@Test
public void addsRequestIfItHasTo() throws MalformedURLException, UnsupportedEncodingException {

    HttpRequest httpRequest = mock(HttpRequest.class, RETURNS_MOCKS);
    Map<String, String> event = getEvent();
    when(httpRequest.getUri()).thenReturn(SUBMIT_EVENT_URL + "?event=mockEvent&text=mockText");
    Predicate<HttpRequest> httpRequestPredicate = mock(Predicate.class);
    when(httpRequestPredicate.test(httpRequest)).thenReturn(true);
    RecordingState recordingState = mock(RecordingState.class);
    HttpRequestToTestCaseStepConverter httpRequestToTestCaseStepConverter = mock(HttpRequestToTestCaseStepConverter.class);
    when(httpRequestToTestCaseStepConverter.convert(httpRequest)).thenReturn(Optional.ofNullable(event));
    EventDetector eventDetector = mock(EventDetector.class);
    when(eventDetector.canDetectPredicate()).thenReturn(httpRequestPredicate);
    when(eventDetector.getConverter()).thenReturn(httpRequestToTestCaseStepConverter);
    List<EventDetector> eventDetectors = Arrays.asList(eventDetector);
    RecordRequestFilter requestFilter = new RecordRequestFilter(recordingState, eventDetectors);
    requestFilter.filterRequest(httpRequest, mock(HttpMessageContents.class), mock(HttpMessageInfo.class));
    verify(recordingState).storeTestCaseStep(event);
}