aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecorator.java3
-rw-r--r--plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecoratorTest.java10
2 files changed, 11 insertions, 2 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecorator.java
index cd122a1c635..84b13feeae2 100644
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecorator.java
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecorator.java
@@ -194,8 +194,7 @@ public class ViolationPersisterDecorator implements Decorator {
}
/**
- * @param data
- * can't be null
+ * @param data can't be null
*/
static List<String> getChecksums(String data) {
String[] lines = data.split("\r?\n|\r", -1);
diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecoratorTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecoratorTest.java
index 44538c85633..f0c88e7b52f 100644
--- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecoratorTest.java
+++ b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecoratorTest.java
@@ -45,8 +45,18 @@ public class ViolationPersisterDecoratorTest {
decorator = new ViolationPersisterDecorator(null, null);
}
+ /**
+ * See http://jira.codehaus.org/browse/SONAR-2358
+ */
@Test
public void shouldGenerateCorrectChecksums() {
+ List<String> encoding = ViolationPersisterDecorator.getChecksums("Привет Мир");
+ assertThat(encoding.size(), is(1));
+ assertThat(encoding.get(0), is("5ba3a45e1299ede07f56e5531351be52"));
+ }
+
+ @Test
+ public void shouldSplitLinesAndIgnoreSpaces() {
List<String> crlf = ViolationPersisterDecorator.getChecksums("Hello\r\nWorld");
List<String> lf = ViolationPersisterDecorator.getChecksums("Hello\nWorld");
List<String> cr = ViolationPersisterDecorator.getChecksums("Hello\rWorld");