HeaderAndBody headerAndBody = mock(HeaderAndBody.class);
when(headerAndBody.getBody()).thenReturn("".getBytes());
when(provider.get()).thenReturn(headerAndBody);
when(factory.get(anyObject(), anyObject())).thenReturn(provider);
AuthorizationFields authFields = new AuthorizationFields();
authFields.addQueryParameter("token", "token");
AuthenticationModule urlModule = mock(AuthenticationModule.class);
when(urlModule.isLoggedIn()).thenReturn(true);
when(urlModule.getAuthorizationFields((URI)anyObject(), anyString(), (byte[]) anyObject())).thenReturn(authFields);