aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorEvgeny Mandrikov <mandrikov@gmail.com>2011-04-24 06:51:32 +0400
committerEvgeny Mandrikov <mandrikov@gmail.com>2011-04-24 07:11:43 +0400
commit29ec06b3e0735692a3d47d2dfd8c8956470ae42f (patch)
tree79089eb8be1d34b29ea23a762b8478627aa5e838 /plugins
parent06af298d5bc741fd45ade3045f98518db1f61357 (diff)
downloadsonarqube-29ec06b3e0735692a3d47d2dfd8c8956470ae42f.tar.gz
sonarqube-29ec06b3e0735692a3d47d2dfd8c8956470ae42f.zip
SONAR-2358 Add unit test
Diffstat (limited to 'plugins')
-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");