package ee.shy.storage;

import org.junit.Before;

import java.nio.file.Path;
import java.util.Arrays;

public class FileStorageTest extends DataStorageTest {
    private Path storageDirectory;

    @Before
    public void setUp() throws Exception {
        storageDirectory = temporaryDirectory.newDirectory("storage");
        storage = new FileStorage(
                Arrays.asList(
                        new GitFileLocator(storageDirectory),
                        new FlatFileLocator(storageDirectory)),
                new AggregateFileAccessor(Arrays.asList(
                        new GzipFileAccessor(),
                        new PlainFileAccessor())));
        super.setUp();
    }
}
@@ -33,20 +33,81 @@
 org.
-junit.Before
+apache.commons.io.IOUtils;%0Aimport org.junit.Before;%0Aimport org.junit.Test
 ;%0A%0Ai
@@ -724,16 +724,16 @@
 r())));%0A
-
         
@@ -752,10 +752,587 @@
 );%0A    %7D
+%0A%0A    @Test%0A    public void testDataChange() throws Exception %7B%0A        Hash hash = storage.put(getClass().getResourceAsStream(%22/fox.txt%22));%0A%0A        GitFileLocator gitFileLocator = new GitFileLocator(storageDirectory);%0A        GzipFileAccessor gzipFileAccessor = new GzipFileAccessor();%0A%0A        gzipFileAccessor.add(gitFileLocator.locate(hash), IOUtils.toInputStream(%22Hello, World!%22));%0A%0A        expectedException.expect(RuntimeException.class);%0A        expectedException.expectMessage(%22not%22);%0A        expectedException.expectMessage(%22match%22);%0A        storage.get(hash);%0A    %7D
 %0A%7D

Add test for hash mismatch checking