FileVaultLocationFactory implements VaultLocationFactory { @Override public VaultLocation getLocation(final DocumentEntity documentEntity) { return getLocation(documentEntity, documentEntity.getCompression()); }  @Override VaultLocation getLocation(final DocumentEntity documentEntity); @Override VaultLocation getLocation(final DocumentEntity documentEntity, final DocumentCompression compression); @Override long getAvailableSpace();  }
@Test void testGetLocationWhenNoCompression() { final VaultLocation result = underTest.getLocation(DOCUMENT_ENTITY, DocumentCompression.NONE); assertThat(result, is(notNullValue())); verify(fileFactory).newFile("testpath", "123e4567-e89b-12d3-a456-556642440000.epub"); }
@Test void testGetLocationWhenCompressionAreProvided() { final VaultLocation result = underTest.getLocation(DOCUMENT_ENTITY, DocumentCompression.GZIP); assertThat(result, is(notNullValue())); verify(fileFactory).newFile("testpath", "123e4567-e89b-12d3-a456-556642440000.epub.gz"); }
@Test void testGetLocationWhenDocumentEntityProvidesTheCompression() { final VaultLocation result = underTest.getLocation(DOCUMENT_ENTITY); assertThat(result, is(notNullValue())); verify(fileFactory,atMostOnce()).newFile(any(), any()); verify(fileFactory).newFile("testpath", "123e4567-e89b-12d3-a456-556642440000.epub.lzma"); }