/** code should output the unchanged bib records if no mhlds match */ @Test public void testNoMatches() throws IOException { // bib46, mhld235 String bibFilePath = testDataParentPath + File.separator + "mhldMergeBibs46.mrc"; String mhldFilePath = testDataParentPath + File.separator + "mhldMergeMhlds235.mrc"; Map<String, Record> mergedRecs = MergeSummaryHoldings.mergeMhldsIntoBibRecordsAsMap(bibFilePath, mhldFilePath); Set<String> mergedRecIds = mergedRecs.keySet(); assertEquals(2, mergedRecIds.size()); // result bibs should match the bib input because there was no merge String id = "a4"; RecordTestingUtils.assertEquals(ALL_UNMERGED_BIBS.get(id), mergedRecs.get(id)); id = "a6"; RecordTestingUtils.assertEquals(ALL_UNMERGED_BIBS.get(id), mergedRecs.get(id)); System.out.println("Test testNoMatches() successful"); }
/** code should find a match when first bib matches non-first mhld */ @Test public void testFirstBibMatchesNonFirstMhld() throws IOException { // bib346, mhld235 String bibFilePath = testDataParentPath + File.separator + "mhldMergeBibs346.mrc"; String mhldFilePath = testDataParentPath + File.separator + "mhldMergeMhlds235.mrc"; Map<String, Record> mergedRecs = MergeSummaryHoldings.mergeMhldsIntoBibRecordsAsMap(bibFilePath, mhldFilePath); // there should be 3 results Set<String> mergedRecIds = mergedRecs.keySet(); assertEquals(3, mergedRecIds.size()); // result bib 3 only should have the mhld fields String id = "a3"; RecordTestingUtils.assertEqualsIgnoreLeader(ALL_MERGED_BIB_RESULTS.get(id), mergedRecs.get(id)); // result bibs 4 and 6 should not be changed id = "a4"; RecordTestingUtils.assertEqualsIgnoreLeader(ALL_UNMERGED_BIBS.get(id), mergedRecs.get(id)); id = "a6"; RecordTestingUtils.assertEquals(ALL_UNMERGED_BIBS.get(id), mergedRecs.get(id)); System.out.println("Test testFirstBibMatchesNonFirstMhld() successful"); }