use of gov.loc.repository.bagit.domain.Bag in project bagit-java by LibraryOfCongress.
the class BagVerifierTest method testCorruptPayloadFile.
@Test(expected = CorruptChecksumException.class)
public void testCorruptPayloadFile() throws Exception {
rootDir = Paths.get(new File("src/test/resources/corruptPayloadFile").toURI());
Bag bag = reader.read(rootDir);
sut.isValid(bag, true);
}
use of gov.loc.repository.bagit.domain.Bag in project bagit-java by LibraryOfCongress.
the class PayloadVerifierTest method testErrorWhenFileIsntInManifest.
@Test(expected = FileNotInManifestException.class)
public void testErrorWhenFileIsntInManifest() throws Exception {
rootDir = Paths.get(new File("src/test/resources/filesInPayloadDirAreNotInManifest").toURI());
Bag bag = reader.read(rootDir);
sut.verifyPayload(bag, true);
}
use of gov.loc.repository.bagit.domain.Bag in project bagit-java by LibraryOfCongress.
the class PayloadVerifierTest method testNotALlFilesListedInAllManifestsThrowsException.
@Test(expected = FileNotInManifestException.class)
public void testNotALlFilesListedInAllManifestsThrowsException() throws Exception {
Path bagDir = Paths.get(new File("src/test/resources/notAllFilesListedInAllManifestsBag").toURI());
Bag bag = reader.read(bagDir);
sut.verifyPayload(bag, true);
}
use of gov.loc.repository.bagit.domain.Bag in project bagit-java by LibraryOfCongress.
the class PayloadVerifierTest method testErrorWhenManifestListFileThatDoesntExist.
@Test(expected = FileNotInPayloadDirectoryException.class)
public void testErrorWhenManifestListFileThatDoesntExist() throws Exception {
rootDir = Paths.get(new File("src/test/resources/filesInManifestDontExist").toURI());
Bag bag = reader.read(rootDir);
sut.verifyPayload(bag, true);
}
use of gov.loc.repository.bagit.domain.Bag in project bagit-java by LibraryOfCongress.
the class MandatoryVerifierTest method testErrorWhenMissingBagitTextFile.
@Test(expected = MissingBagitFileException.class)
public void testErrorWhenMissingBagitTextFile() throws Exception {
copyBagToTestFolder();
Bag bag = reader.read(Paths.get(folder.getRoot().toURI()));
File bagitFile = new File(folder.getRoot(), "bagit.txt");
bagitFile.delete();
MandatoryVerifier.checkBagitFileExists(bag.getRootDir(), bag.getVersion());
}
Aggregations