### Question:
ServiceCombClient { public boolean updateInstanceStatus(String serviceId, String instanceId, String status) throws ServiceCombException { Response response = null; try { StringEntity stringEntity = new StringEntity("", "utf-8"); response = httpTransport.sendPutRequest( buildURI( "/registry/microservices/" + serviceId + "/instances/" + instanceId + "/status?value=" + status), stringEntity); if (response.getStatusCode() == HttpStatus.SC_OK) { LOGGER.info(" update instance status success."); return true; } throw new RemoteOperationException( "update instance status failed. status:" + response.getStatusCode() + "; message:" + response.getStatusMessage() + "; content:" + response.getContent()); } catch (URISyntaxException e) { throw new RemoteOperationException("build url failed.", e); } } ServiceCombClient(String urls, HttpTransport httpTransport); void autoDiscovery(boolean autoDiscovery); MicroserviceInstancesResponse getServiceCenterInstances(); String registerMicroservice(Microservice microservice); String getServiceId(Microservice microservice); SchemaResponse getSchemas(String serviceId); String registerInstance(MicroserviceInstance microserviceInstance); boolean deRegisterInstance(String serviceId, String instanceId); List<ServiceInstance> getInstances(Microservice microservice, String revision); MicroserviceInstanceSingleResponse getInstance(String serviceId, String instanceId); HeardBeatStatus heartbeat(HeartbeatRequest heartbeatRequest); boolean updateInstanceStatus(String serviceId, String instanceId, String status); MicroserviceResponse getServices(); boolean registerSchema(String microserviceId, String schemaId, String schemaContent); static String calcSchemaSummary(String schemaContent); void toggle(); String getUrl(); static String INSTANCE_STATUS; static String ZONE; }### Answer:
@Test public void updateInstanceStatus(@Injectable HttpTransport httpTransport) throws ServiceCombException, IOException { final int expectedCode = 200; Response response = new Response(); response.setStatusCode(expectedCode); String responseString = "{}"; response.setContent(responseString); new Expectations() { { Deencapsulation.newUninitializedInstance(DefaultHttpTransport.class); result = httpTransport; httpTransport.sendPutRequest(anyString, (HttpEntity) any); result = response; } }; ServiceCombClient serviceCombClient = new ServiceCombClient(url, httpTransport); serviceCombClient.updateInstanceStatus("1", "2", "UP"); }