aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-testing-harness/src
diff options
context:
space:
mode:
authorFabrice Bellingard <bellingard@gmail.com>2011-09-05 09:47:06 +0200
committerFabrice Bellingard <bellingard@gmail.com>2011-09-05 09:47:06 +0200
commit66dcfc8adc7b36d31e0fd80353066a2d6938cd98 (patch)
tree2c601595163326c201f80fa2a686edb70d8b8293 /sonar-testing-harness/src
parent2a78a620de5d1f43ba869385250ed120621b2f0b (diff)
downloadsonarqube-66dcfc8adc7b36d31e0fd80353066a2d6938cd98.tar.gz
sonarqube-66dcfc8adc7b36d31e0fd80353066a2d6938cd98.zip
SONAR-2693 A bit of refactoring
Diffstat (limited to 'sonar-testing-harness/src')
-rw-r--r--sonar-testing-harness/src/main/java/org/sonar/test/i18n/BundleSynchronizedMatcher.java23
1 files changed, 16 insertions, 7 deletions
diff --git a/sonar-testing-harness/src/main/java/org/sonar/test/i18n/BundleSynchronizedMatcher.java b/sonar-testing-harness/src/main/java/org/sonar/test/i18n/BundleSynchronizedMatcher.java
index 18351b9c70b..8d794b01dfc 100644
--- a/sonar-testing-harness/src/main/java/org/sonar/test/i18n/BundleSynchronizedMatcher.java
+++ b/sonar-testing-harness/src/main/java/org/sonar/test/i18n/BundleSynchronizedMatcher.java
@@ -94,6 +94,18 @@ public class BundleSynchronizedMatcher extends BaseMatcher<String> {
}
public void describeTo(Description description) {
+ // report file
+ File dumpFile = new File("target/l10n/" + bundleName + ".report.txt");
+
+ // prepare message
+ StringBuilder details = prepareDetailsMessage(dumpFile);
+ description.appendText(details.toString());
+
+ // print report in target directory
+ printReport(dumpFile, details.toString());
+ }
+
+ private StringBuilder prepareDetailsMessage(File dumpFile) {
StringBuilder details = new StringBuilder("\n=======================\n'");
details.append(bundleName);
details.append("' is not synchronized.");
@@ -109,15 +121,12 @@ public class BundleSynchronizedMatcher extends BaseMatcher<String> {
details.append("\n\t- " + key);
}
}
- details.append("\n\n=======================");
-
- printReport(details.toString());
-
- description.appendText(details.toString());
+ details.append("\n\nSee report file located at: " + dumpFile.getAbsolutePath());
+ details.append("\n=======================");
+ return details;
}
- private void printReport(String details) {
- File dumpFile = new File("target/l10n/" + bundleName + ".report.txt");
+ private void printReport(File dumpFile, String details) {
if (dumpFile.exists()) {
dumpFile.delete();
}