diff --git a/core/src/main/groovy/org/aim42/htmlsanitycheck/check/BrokenCrossReferencesChecker.groovy b/core/src/main/groovy/org/aim42/htmlsanitycheck/check/BrokenCrossReferencesChecker.groovy
index 9c09f30f..10628410 100644
--- a/core/src/main/groovy/org/aim42/htmlsanitycheck/check/BrokenCrossReferencesChecker.groovy
+++ b/core/src/main/groovy/org/aim42/htmlsanitycheck/check/BrokenCrossReferencesChecker.groovy
@@ -81,13 +81,15 @@ class BrokenCrossReferencesChecker extends Checker {
if (!listOfIds.contains( linkTarget )) {
// we found a broken link!
+ String findingText = "link target \"$linkTarget\" missing"
// now count occurrences - how often is it referenced
int nrOfReferences = hrefList.findAll{ it == href }.size()
+ if (nrOfReferences > 1) {
+ findingText += ", reference count: $nrOfReferences"
+ }
- String findingText = "link target \"$linkTarget\" missing (reference count $nrOfReferences)"
-
- checkingResults.newFinding(findingText)
+ checkingResults.newFinding(findingText, nrOfReferences)
}
}
diff --git a/core/src/test/groovy/org/aim42/htmlsanitycheck/check/BrokenCrossReferencesCheckerTest.groovy b/core/src/test/groovy/org/aim42/htmlsanitycheck/check/BrokenCrossReferencesCheckerTest.groovy
index 9406cb1d..9adf6384 100644
--- a/core/src/test/groovy/org/aim42/htmlsanitycheck/check/BrokenCrossReferencesCheckerTest.groovy
+++ b/core/src/test/groovy/org/aim42/htmlsanitycheck/check/BrokenCrossReferencesCheckerTest.groovy
@@ -69,7 +69,7 @@ class BrokenCrossReferencesCheckerTest extends GroovyTestCase {
assertEquals( "expected two checks", 2, collector.nrOfItemsChecked)
String actual = collector.findings.first()
- String expected = "link target \"nonexisting\" missing (reference count 1)"
+ String expected = "link target \"nonexisting\" missing"
String message = "expected $expected"
assertEquals(message, expected, actual)
@@ -122,14 +122,14 @@ class BrokenCrossReferencesCheckerTest extends GroovyTestCase {
// first finding: aim42 link missing
String actual = collector.findings.first()
- String expected = "link target \"arc42\" missing (reference count 1)"
+ String expected = "link target \"arc42\" missing"
String message = "expected $expected"
assertEquals(message, expected, actual)
// second finding: arc42 link missing
actual = collector.findings[1]
- expected = "link target \"aim42\" missing (reference count 1)"
+ expected = "link target \"aim42\" missing"
assertEquals(message, expected, actual)
}
@@ -152,12 +152,12 @@ class BrokenCrossReferencesCheckerTest extends GroovyTestCase {
collector = undefinedInternalLinksChecker.performCheck()
- assertEquals( "expected one finding", 1, collector.nrOfProblems())
+ assertEquals( "expected five findings", 5, collector.nrOfProblems())
assertEquals( "expected one check", 1, collector.nrOfItemsChecked)
// finding: aim42 link missing, reference count 5
String actual = collector.findings.first()
- String expected = "link target \"aim42\" missing (reference count 5)"
+ String expected = "link target \"aim42\" missing, reference count: 5"
String message = "expected $expected"
assertEquals(message, expected, actual)