ElasticSearchUtils { public static String buildEsIndexNameCurrent(String esIndexPrefix, SimpleDateFormat indexDateFormatSuffix) { return String.format("%s%s", esIndexPrefix, indexDateFormatSuffix.format(new Date())); }  static String buildEsIndexNameCurrent(String esIndexPrefix, SimpleDateFormat indexDateFormatSuffix); static final SimpleDateFormat DATE_FORMAT; }
@Test public void verifyCurrentEsIndexName() { SimpleDateFormat indexDateFormat = new SimpleDateFormat("yyyyMM"); String monthlySuffix = indexDateFormat.format(new Date()); String esIndexNameCurrent = ElasticSearchUtils.buildEsIndexNameCurrent("workloads_", indexDateFormat); assertThat(esIndexNameCurrent).isNotNull(); assertThat(esIndexNameCurrent).isNotEmpty(); assertThat(esIndexNameCurrent).isEqualTo(String.format("workloads_%s", monthlySuffix)); }