*/
public void testPhotoAddition() {
String fname = "test1.jpg";
File f = new File( testImgDir, fname );
PhotoInfo photo = null;
try {
photo = PhotoInfo.addToDB( f );
} catch ( PhotoNotFoundException e ) {
fail( "Could not find photo: " + e.getMessage() );
}
PhotoFolder folder = null;
// Create a folder for the photo
try {
folder = PhotoFolder.create( "PhotoAdditionTest", PhotoFolder.getRoot() );
folder.addPhoto( photo );
assertEquals( "Photo not visible in folders' photo count", folder.getPhotoCount(), 1 );
} finally {
// Clean up the test folder
PhotoFolder parent = folder.getParentFolder();
parent.removeSubfolder( folder );
photo.delete();
}
}