### Question:
EsIndex { public static void swapIndexInAliases(EsConfig config, Set<String> aliases, String index) { Preconditions.checkArgument(aliases != null && !aliases.isEmpty(), "alias is required"); Preconditions.checkArgument(!Strings.isNullOrEmpty(index), "index is required"); swapIndexInAliases( config, aliases, index, Collections.emptySet(), Searching.getDefaultSearchSettings()); }  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 swapIndexInAliasNullAliasTest() { EsIndex.swapIndexInAliases(EsConfig.from(DUMMY_HOST), null, "index_1"); thrown.expectMessage("aliases are required"); }
@Test(expected = IllegalArgumentException.class) public void swapIndexInAliasEmptyAliasTest() { EsIndex.swapIndexInAliases(EsConfig.from(DUMMY_HOST), Collections.singleton(""), "index_1"); thrown.expectMessage("aliases are required"); }
@Test(expected = IllegalArgumentException.class) public void swapIndexInAliasNullIndexTest() { EsIndex.swapIndexInAliases(EsConfig.from(DUMMY_HOST), Collections.singleton("alias"), null); thrown.expectMessage("index is required"); }
@Test(expected = IllegalArgumentException.class) public void swapIndexInAliasEmptyIndexTest() { EsIndex.swapIndexInAliases(EsConfig.from(DUMMY_HOST), Collections.singleton("alias"), ""); thrown.expectMessage("index is required"); }
@Test(expected = IllegalArgumentException.class) public void swapIndexInAliasWrongFormatIndexTest() { EsIndex.swapIndexInAliases(EsConfig.from(DUMMY_HOST), Collections.singleton("alias"), "index"); thrown.expectMessage(CoreMatchers.containsString("index has to follow the pattern")); }