### Question:
EsIndex { public static long countDocuments(EsConfig config, String index) { Preconditions.checkArgument(!Strings.isNullOrEmpty(index), "index is required"); log.info("Counting documents from index {}", index); try (EsClient esClient = EsClient.from(config)) { return EsService.countIndexDocuments(esClient, index); } }  static String createIndex(EsConfig config, IndexParams indexParams); static Optional<String> createIndexIfNotExists(EsConfig config, IndexParams indexParams); static void swapIndexInAliases(EsConfig config, Set<String> aliases, String index); static void swapIndexInAliases(
      EsConfig config,
      Set<String> aliases,
      String index,
      Set<String> extraIdxToRemove,
      Map<String, String> settings); static long countDocuments(EsConfig config, String index); static Set<String> deleteRecordsByDatasetId(
      EsConfig config,
      String[] aliases,
      String datasetKey,
      Predicate<String> indexesToDelete,
      int timeoutSec,
      int attempts); static Set<String> findDatasetIndexesInAliases(
      EsConfig config, String[] aliases, String datasetKey);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void countIndexDocumentsNullIndexTest() { EsIndex.countDocuments(EsConfig.from(DUMMY_HOST), null); thrown.expectMessage("index is required"); }
@Test(expected = IllegalArgumentException.class) public void countIndexDocumentsEmptyIndexTest() { EsIndex.countDocuments(EsConfig.from(DUMMY_HOST), ""); thrown.expectMessage("index is required"); }