### Question:
RegistrationService extends EscrowAgentService { public ClientCredentials register() throws IOException, EscrowAgentErrorResponseException { super.getClient().checkNotNull(); String url = "https: + EscrowAgent.getRegistrationService(); TreeMap<String, String> parameters = getParameters(); String response = callEscrowAgentService(RequestEncoder .normalizeParametersQuery(parameters), url); return (ClientCredentials) ResponseParser.toObject(response, ClientCredentials.class); } RegistrationService(final Client client,
            final EscrowAgent escrowAgent, final SecureConnection con); @Override TreeMap<String, String> getParameters(); ClientCredentials register();  }### Answer:
@Test public void testRegister() throws IOException, EscrowAgentErrorResponseException { RegistrationService mockService = Mockito.spy(service); Mockito.doReturn("client_id=id&client_secret=secret") .when((EscrowAgentService) mockService) .callEscrowAgentService(Mockito.anyString(), Mockito.anyString()); ClientCredentials clientCredentials = mockService.register(); Assert.assertEquals(clientCredentials.getClientId(), "id"); Assert.assertEquals(clientCredentials.getClientSecret(), "secret"); Mockito.verify((EscrowAgentService) mockService, Mockito.times(1)) .callEscrowAgentService(Mockito.anyString(), Mockito.anyString()); }