### Question:
Client extends AbstractClient { public @NonNull Index getIndex(@NonNull String indexName) { Index index = null; WeakReference<Object> existingIndex = indices.get(indexName); if (existingIndex != null) { index = (Index) existingIndex.get(); } if (index == null) { index = new Index(this, indexName); indices.put(indexName, new WeakReference<Object>(index)); } return index; } Client(@NonNull String applicationID, @NonNull String apiKey);  Client(@NonNull String applicationID, @NonNull String apiKey, @Nullable String[] hosts); @NonNull String getApplicationID(); Index initIndex(@NonNull String indexName); @NonNull Index getIndex(@NonNull String indexName); Request listIndexesAsync(@Nullable final RequestOptions requestOptions, @NonNull CompletionHandler completionHandler); Request listIndexesAsync(@NonNull CompletionHandler completionHandler); Request deleteIndexAsync(final @NonNull String indexName, @Nullable final RequestOptions requestOptions, CompletionHandler completionHandler); Request deleteIndexAsync(final @NonNull String indexName, CompletionHandler completionHandler); Request moveIndexAsync(final @NonNull String srcIndexName, final @NonNull String dstIndexName, @Nullable final RequestOptions requestOptions, CompletionHandler completionHandler); Request moveIndexAsync(final @NonNull String srcIndexName, final @NonNull String dstIndexName, CompletionHandler completionHandler); Request copyIndexAsync(final @NonNull String srcIndexName, final @NonNull String dstIndexName, @Nullable final RequestOptions requestOptions, CompletionHandler completionHandler); Request copyIndexAsync(final @NonNull String srcIndexName, final @NonNull String dstIndexName, CompletionHandler completionHandler); Request multipleQueriesAsync(final @NonNull List<IndexQuery> queries, final MultipleQueriesStrategy strategy, @Nullable final RequestOptions requestOptions, @NonNull CompletionHandler completionHandler); Request multipleQueriesAsync(final @NonNull List<IndexQuery> queries, final MultipleQueriesStrategy strategy, @NonNull CompletionHandler completionHandler); Request batchAsync(final @NonNull JSONArray operations, @Nullable final RequestOptions requestOptions, CompletionHandler completionHandler); Request batchAsync(final @NonNull JSONArray operations, CompletionHandler completionHandler);  }### Answer:
@Test public void testIndexReuse() throws Exception { Map<String, WeakReference<Index>> indices = (Map<String, WeakReference<Index>>) Whitebox.getInternalState(client, "indices"); final String indexName = "name"; assertEquals(0, indices.size()); Index index1 = client.getIndex(indexName); assertEquals(1, indices.size()); Index index2 = client.getIndex(indexName); assertEquals(index1, index2); assertEquals(1, indices.size()); }