Add equals methods on objects, use for storetest

This commit is contained in:
Adam
2015-10-16 12:52:38 -04:00
parent bd5d57e94c
commit 298d623bbf
7 changed files with 257 additions and 22 deletions

View File

@@ -22,36 +22,21 @@ public class StoreTest
@Test
public void testOneFile() throws IOException
{
File file;
try (Store store = new Store(folder.getRoot()))
{
Index index = store.addIndex(0);
Archive archive = index.addArchive(0);
file = archive.addFile(0);
File file = archive.addFile(0);
file.setContents("test".getBytes());
store.save();
}
try (Store store = new Store(folder.getRoot()))
{
store.load();
List<Index> indexes = store.getIndexes();
Assert.assertEquals(1, indexes.size());
Index index = indexes.get(0);
List<Archive> archives = index.getArchives();
Assert.assertEquals(1, archives.size());
Archive archive = archives.get(0);
List<File> files = archive.getFiles();
// XXX just use equals methods on store duh
//archive.
File file2 = files.get(0);
Assert.assertArrayEquals(file.getContents(), file2.getContents());
try (Store store2 = new Store(folder.getRoot()))
{
store2.load();
Assert.assertEquals(store, store2);
}
}
}
}