@Bean
  protected WebClientFactoryI mockWebClientFactory() throws WebException {
    WebClientI client = mock(WebClientI.class);
    WebResponseI response = mock(WebResponseI.class);
    when(response.getBody())
        .thenReturn(StringUtils.getBytesUtf8(FURBY_CHECK_SESSION_JSON_RESPONSE));
    when(response.getEncoding()).thenReturn("UTF-8");
    when(client.execute(any())).thenReturn(response);
    WebClientFactoryI factory = mock(WebClientFactoryI.class);
    when(factory.createWebClient(anyString())).thenReturn(client);

    return factory;
  }
Exemplo n.º 2
0
 public static WebClientI prepareWebClient(String body, String encoding) throws WebException {
   WebClientI client = mock(WebClientI.class);
   WebResponseI response = prepareWebResponse(body, encoding);
   when(client.execute(any())).thenReturn(response);
   return client;
 }