@Test
void testTemplatedFilenameWithDate() throws IOException {

    // template should be case insensitive as far as key names go as the metamap is case insensitive
    final String repositoryFormat = "${year}-${month}-${day}/${feed}/${id}";
    final String FEED_NAME = "myFeed";
    final String repoDir = FileUtil.getCanonicalPath(Files.createTempDirectory("stroom").resolve("repo3"));
    StroomZipRepository stroomZipRepository = new StroomZipRepository(repoDir, repositoryFormat, false, 10000, 0, false);
    AttributeMap attributeMap = new AttributeMap();
    attributeMap.put("feed", FEED_NAME);
    StroomZipOutputStreamImpl out1;
    try (final StroomZipOutputStreamImpl out = (StroomZipOutputStreamImpl) stroomZipRepository.getStroomZipOutputStream(attributeMap)) {
        StroomZipOutputStreamUtil.addSimpleEntry(out, new StroomZipEntry(null, "file", StroomZipFileType.Data),
                "SOME_DATA".getBytes(CharsetConstants.DEFAULT_CHARSET));
        assertThat(Files.isRegularFile(out.getFile())).isFalse();
        out1 = out;
    }
    Path zipFile = out1.getFile();
    Path feedDir = zipFile.getParent();
    Path dateDir = feedDir.getParent();
    String dateDirStr = dateDir.getFileName().toString();
    assertThat(Files.isRegularFile(zipFile)).isTrue();
    assertThat(feedDir.getFileName().toString()).isEqualTo(FEED_NAME);
    String pattern = "yyyy-MM-dd";
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
    String nowStr = simpleDateFormat.format(new Date());
    assertThat(dateDirStr).isEqualTo(nowStr);
}