@Test
public void testCreateForDomain() throws IOException {

    OkHttpClient mockClient = mock(OkHttpClient.class);
    FederationServer.setHttpClient(mockClient);
    Call mockCall = mock(Call.class);
    when(mockClient.newCall((Request) any())).thenReturn(mockCall);
    Response mockResponseSuccess = new Response.Builder()
            .code(200)
            .message("OK")
            .protocol(Protocol.HTTP_1_1)
            .body(ResponseBody.create(MediaType.parse("application/json"), stellarToml))
            .request(new Request.Builder()
                    .url("http://www.test.com")
                    .get()
                    .build())
            .build();
    when(mockCall.execute()).thenReturn(mockResponseSuccess);
    FederationServer server = FederationServer.createForDomain("stellar.org");
    assertEquals(server.getServerUri().toString(), "https://api.stellar.org/federation");
    assertEquals(server.getDomain(), "stellar.org");
    ArgumentCaptor<Request> argument = ArgumentCaptor.forClass(Request.class);
    verify(mockClient).newCall(argument.capture());
    assertEquals(URI.create("https://stellar.org/.well-known/stellar.toml"), argument.getValue().url().uri());
}