    @Test
    public void testIndexNameToPreCreate() throws IOException, UnsupportedAutoIndexException {

        List<IndexMetadata> indexMetadataList = IndexUtils.parseIndexMetadata(
                "[ { \"retentionType\": \"yearly\", \"retentionPeriod\": 20, \"indexName\": \"index\" }," +
                        "{ \"retentionType\": \"monthly\", \"retentionPeriod\": 20, \"indexName\": \"0\" }," +
                        "{ \"retentionType\": \"hourly\", \"retentionPeriod\": 20, \"indexName\": \"index1\", \"preCreate\": \"true\" }," +
                        "{ \"retentionType\": \"daily\", \"retentionPeriod\": 20, \"indexName\": \"nf_errors_log_useast1\", \"preCreate\": \"false\" }]");

        IndexMetadata yearlyMetadata = indexMetadataList.get(0);
        IndexMetadata monthlyMetadata = indexMetadataList.get(1);
        IndexMetadata hourlyMetadata = indexMetadataList.get(2);
        IndexMetadata dailyMetadata = indexMetadataList.get(3);

        DateTime currentDateTime = new DateTime("2017-11-15T12:34:56Z");

        assertEquals("index2018", yearlyMetadata.getIndexNameToPreCreate(currentDateTime));
        assertEquals("0201712", monthlyMetadata.getIndexNameToPreCreate(currentDateTime));
        assertEquals("nf_errors_log_useast120171116", dailyMetadata.getIndexNameToPreCreate(currentDateTime));
        assertEquals("index12017111513", hourlyMetadata.getIndexNameToPreCreate(currentDateTime));
    }