]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2358 Add unit test
authorEvgeny Mandrikov <mandrikov@gmail.com>
Sun, 24 Apr 2011 02:51:32 +0000 (06:51 +0400)
committerEvgeny Mandrikov <mandrikov@gmail.com>
Sun, 24 Apr 2011 03:11:43 +0000 (07:11 +0400)
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecorator.java
plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecoratorTest.java

index cd122a1c6350ae82a40e985f64061493b0632f17..84b13feeae2ba733af87e91f4023e88d982a374d 100644 (file)
@@ -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);
index 44538c856335073f25d792c008c03e892ad66dfb..f0c88e7b52fd2992eb1205c41e644541154ed635 100644 (file)
@@ -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");