private AbstractFunctionCallResult buildMockFunctionCallResult() {
   final AbstractFunctionCallResult functionCallResult = mock(AbstractFunctionCallResult.class);
   when(functionCallResult.getApplicationName()).thenReturn("test_app_name");
   when(functionCallResult.getMimeType()).thenReturn(Constants.XML_MIME_TYPE);
   when(functionCallResult.getPayload()).thenReturn("<fake />");
   return functionCallResult;
 }
  @Test
  public void processFunctionCallResultFailure() throws IOException {
    final AbstractFunctionCallResult functionCallResult = buildMockFunctionCallResult();
    when(functionCallResult.isSuccess()).thenReturn(false);

    restResultProcessor.process(functionCallResult);

    verify(resultStore).store(any(PersistedResult.class));
    verify(functionCallResult).destroy();
  }