### Question:
RestfulEnclaveClient implements EnclaveClient { @Override public Service.Status status() { Future<Service.Status> outcome = executorService.submit( () -> { Response response = client.target(uri).path("ping").request().get(); if (response.getStatus() == 200) { return Service.Status.STARTED; } return Service.Status.STOPPED; }); try { return outcome.get(2, TimeUnit.SECONDS); } catch (InterruptedException | ExecutionException | TimeoutException ex) { LOGGER.trace(null, ex); return Service.Status.STOPPED; } } RestfulEnclaveClient(Client client, URI uri);  RestfulEnclaveClient(Client client, URI uri, ExecutorService executorService); @Override PublicKey defaultPublicKey(); @Override Set<PublicKey> getForwardingKeys(); @Override Set<PublicKey> getPublicKeys(); @Override EncodedPayload encryptPayload(
            byte[] message, PublicKey senderPublicKey, List<PublicKey> recipientPublicKeys); @Override EncodedPayload encryptPayload(RawTransaction rawTransaction, List<PublicKey> recipientPublicKeys); @Override RawTransaction encryptRawPayload(byte[] message, PublicKey sender); @Override byte[] unencryptTransaction(EncodedPayload payload, PublicKey providedKey); @Override byte[] createNewRecipientBox(final EncodedPayload payload, final PublicKey recipientKey); @Override Service.Status status();  }### Answer:
@Test public void statusStarted() { when(enclave.status()).thenReturn(Service.Status.STARTED); assertThat(enclaveClient.status()).isEqualTo(Service.Status.STARTED); verify(enclave).status(); }
@Test public void statusStopped() { when(enclave.status()).thenThrow(RuntimeException.class); assertThat(enclaveClient.status()).isEqualTo(Service.Status.STOPPED); verify(enclave).status(); }
@Test public void enclaveUnavialable() throws Exception { ExecutorService executorService = mock(ExecutorService.class); Future<?> future = mock(Future.class); doReturn(future).when(executorService).submit(any(Callable.class)); doThrow(TimeoutException.class).when(future).get(anyLong(), any(TimeUnit.class)); RestfulEnclaveClient restfulEnclaveClient = new RestfulEnclaveClient(jersey.client(), jersey.target().getUri(), executorService); Status result = restfulEnclaveClient.status(); assertThat(result).isEqualTo(Service.Status.STOPPED); }