### Question:
FolderHashEncoderNamingStrategy implements NamingStrategy { public String rename(final String originalName, final InputStream inputStream) throws IOException { notNull(originalName); notNull(inputStream); try{ final String hash = getHashStrategy().getHash(inputStream); final StringBuilder sb = new StringBuilder(hash).append("/").append(originalName); return sb.toString(); }finally{ IOUtils.closeQuietly(inputStream); } }  String rename(final String originalName, final InputStream inputStream); static final String ALIAS; }### Answer:
@Test(expected = NullPointerException.class) public void cannotAcceptNullResourceName() throws Exception { namingStrategy.rename(null, WroUtil.EMPTY_STREAM); }
@Test(expected = NullPointerException.class) public void cannotAcceptNullStream() throws Exception { namingStrategy.rename("fileName.js", null); }
@Test public void shouldRenameResourceWithEmptyContent() throws Exception { final String result = namingStrategy.rename("fileName", WroUtil.EMPTY_STREAM); assertEquals("da39a3ee5e6b4b0d3255bfef95601890afd80709/fileName", result); }
@Test public void shouldRenameResourceWithSomeContent() throws Exception { final String result = namingStrategy.rename("anotherFile.js", new ByteArrayInputStream("someContent".getBytes())); assertEquals("99ef8ae827896f2af4032d5dab9298ec86309abf/anotherFile.js", result); }
@Test public void shouldRenameResourceContainedInAFolder() throws Exception { final String result = namingStrategy.rename("folder1/folder2/resource.css", new ByteArrayInputStream("someContent".getBytes())); assertEquals("99ef8ae827896f2af4032d5dab9298ec86309abf/folder1/folder2/resource.css", result); }