XSSFCell cell = row.createCell(i);
cell.setHyperlink(link);
}
workbook = XSSFTestDataSamples.writeOutAndReadBack(workbook);
sheet = workbook.getSheetAt(0);
PackageRelationshipCollection rels = sheet.getPackagePart().getRelationships();
assertEquals(urls.length, rels.size());
for(int i = 0; i < rels.size(); i++){
PackageRelationship rel = rels.getRelationship(i);
// there should be a relationship for each URL
assertEquals(urls[i], rel.getTargetURI().toString());
}
// Bugzilla 53041: Hyperlink relations are duplicated when saving XSSF file
workbook = XSSFTestDataSamples.writeOutAndReadBack(workbook);
sheet = workbook.getSheetAt(0);
rels = sheet.getPackagePart().getRelationships();
assertEquals(urls.length, rels.size());
for(int i = 0; i < rels.size(); i++){
PackageRelationship rel = rels.getRelationship(i);
// there should be a relationship for each URL
assertEquals(urls[i], rel.getTargetURI().toString());
}
}