Skip to content
Permalink
Browse files

JENKINS-31238 fix test

  • Loading branch information
aquarellian committed Oct 31, 2015
1 parent 7ec80db commit 2660fe4076d13880d593c0061f68056805fbf880
@@ -23,17 +23,17 @@
@Test
public void testKnownUrl() throws IOException, InterruptedException, URISyntaxException {
Issue i = getIssue();
String text = "<severity> Sonar violation:\n\n\n<message>\n\n\nRead more: <rule_url>";
String expectedResult = "MINOR Sonar violation:\n\n\nRemove this unused import 'com.magenta.guice.property.PropertiesHandler'.\n\n\nRead more: http://localhost:9000/coding_rules#rule_key=squid%3AUselessImportCheck";
String text = "<severity> SonarQube violation:\n\n\n<message>\n\n\nRead more: <rule_url>";
String expectedResult = "MINOR SonarQube violation:\n\n\nRemove this unused import 'com.magenta.guice.property.PropertiesHandler'.\n\n\nRead more: http://localhost:9000/coding_rules#rule_key=squid%3AUselessImportCheck";
CustomIssueFormatter basicIssueConverter = new CustomIssueFormatter(i, text, "http://localhost:9000");
Assert.assertEquals(expectedResult, basicIssueConverter.getMessage());
}

@Test
public void testUnknownUrl() throws IOException, InterruptedException, URISyntaxException {
Issue i = getIssue();
String text = "<severity> Sonar violation:\n\n\n<message>\n\n\nRead more: <rule_url>";
String expectedResult = "MINOR Sonar violation:\n\n\nRemove this unused import 'com.magenta.guice.property.PropertiesHandler'.\n\n\nRead more: squid:UselessImportCheck";
String text = "<severity> SonarQube violation:\n\n\n<message>\n\n\nRead more: <rule_url>";
String expectedResult = "MINOR SonarQube violation:\n\n\nRemove this unused import 'com.magenta.guice.property.PropertiesHandler'.\n\n\nRead more: squid:UselessImportCheck";
CustomIssueFormatter basicIssueConverter = new CustomIssueFormatter(i, text, null);
Assert.assertEquals(expectedResult, basicIssueConverter.getMessage());
}
@@ -22,8 +22,8 @@
* $Id$
*/
public class CustomReportFormatterTest {
private static String SUCCESS_TEXT = "Sonar violations have not been found.";
private static String FAIL_TEXT = "<total_count> Sonar violations have been found.\n" +
private static String SUCCESS_TEXT = "SonarQube violations have not been found.";
private static String FAIL_TEXT = "<total_count> SonarQube violations have been found.\n" +
"Info: <info_count>\n" +
"Minor: <minor_count>\n" +
"Major: <major_count>\n" +
@@ -36,15 +36,15 @@
@Test
public void testSuccess() throws IOException, InterruptedException, URISyntaxException {
List<Issue> i = new ArrayList<Issue>();
String expectedResult = "Sonar violations have not been found.";
String expectedResult = "SonarQube violations have not been found.";
CustomReportFormatter basicIssueConverter = new CustomReportFormatter(i, FAIL_TEXT, SUCCESS_TEXT);
Assert.assertEquals(expectedResult, basicIssueConverter.getMessage());
}

@Test
public void testFail() throws IOException, InterruptedException, URISyntaxException {
List<Issue> i = getIssues();
String expectedResult = "19 Sonar violations have been found.\n" +
String expectedResult = "19 SonarQube violations have been found.\n" +
"Info: 1\n" +
"Minor: 6\n" +
"Major: 10\n" +
@@ -60,7 +60,7 @@ public void testFail() throws IOException, InterruptedException, URISyntaxExcept
@Test
public void testSuccessEmpty() throws IOException, InterruptedException, URISyntaxException {
List<Issue> i = new ArrayList<Issue>();
String expectedResult = "Sonar violations have not been found.";
String expectedResult = "SonarQube violations have not been found.";
CustomReportFormatter basicIssueConverter = new CustomReportFormatter(i, "", "");
Assert.assertEquals(expectedResult, basicIssueConverter.getMessage());
basicIssueConverter = new CustomReportFormatter(i, null, null);
@@ -70,7 +70,7 @@ public void testSuccessEmpty() throws IOException, InterruptedException, URISynt
@Test
public void testFailEmpty() throws IOException, InterruptedException, URISyntaxException {
List<Issue> i = getIssues();
String expectedResult = "19 Sonar violations have been found.";
String expectedResult = "19 SonarQube violations have been found.";
CustomReportFormatter basicIssueConverter = new CustomReportFormatter(i, "", "");
Assert.assertEquals(expectedResult, basicIssueConverter.getMessage());
basicIssueConverter = new CustomReportFormatter(i, null, null);

0 comments on commit 2660fe4

Please sign in to comment.