mirror of
https://github.com/SonarSource/sonarqube.git
synced 2024-08-03 08:18:00 +02:00
SONAR-2358 Add unit test
This commit is contained in:
parent
06af298d5b
commit
29ec06b3e0
@ -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);
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user