@Override
    public Boolean exists(final String key) {
        try {
            KV kvClient = etcdClient.getKVClient();
            GetOption option = GetOption.newBuilder().isPrefix(true).withCountOnly(true).build();
            GetResponse response = kvClient.get(bytesOf(key), option).get();
            return response.getCount() > 0;
        } catch (InterruptedException | ExecutionException e) {
            throw new ShenyuException(e);
        }
    }
@Test
    void testExists() throws ExecutionException, InterruptedException {
        final String key = "key";
        final KV kvClient = mock(KV.class);
        when(etcdClient.getKVClient()).thenReturn(kvClient);

        final GetResponse getResponse = mock(GetResponse.class);
        when(getResponse.getCount()).thenReturn(1L);
        final CompletableFuture<GetResponse> completableFuture = mock(CompletableFuture.class);
        when(completableFuture.get()).thenReturn(getResponse);
        when(kvClient.get(any(ByteSequence.class), any(GetOption.class))).thenReturn(completableFuture);

        final Boolean result = etcdDiscoveryServiceUnderTest.exists(key);
        assertTrue(result);
        doThrow(new InterruptedException("test")).when(completableFuture).get();
        assertThrows(ShenyuException.class, () -> etcdDiscoveryServiceUnderTest.exists(key));
    }