Fixed Code Climate renderer test

This commit is contained in:
Robert Sösemann
2016-04-18 15:39:46 +02:00
parent c50fd060ed
commit 9d5598e63a
2 changed files with 8 additions and 4 deletions

View File

@ -72,13 +72,17 @@ public class CodeClimateRenderer extends AbstractIncrementingRenderer {
break; break;
} }
issue.remediation_points = REMEDIATION_POINTS_DEFAULT;
if(rule.hasDescriptor(CODECLIMATE_REMEDIATION_MULTIPLIER)) { if(rule.hasDescriptor(CODECLIMATE_REMEDIATION_MULTIPLIER)) {
issue.remediation_points = rule.getProperty(CODECLIMATE_REMEDIATION_MULTIPLIER) * REMEDIATION_POINTS_DEFAULT; issue.remediation_points *= rule.getProperty(CODECLIMATE_REMEDIATION_MULTIPLIER);
} }
if(rule.hasDescriptor(CODECLIMATE_CATEGORIES)) { if(rule.hasDescriptor(CODECLIMATE_CATEGORIES)) {
issue.categories = rule.getProperty(CODECLIMATE_CATEGORIES); issue.categories = rule.getProperty(CODECLIMATE_CATEGORIES);
} }
else {
issue.categories = new String[]{ "Style" };
}
return issue; return issue;
} }

View File

@ -14,7 +14,7 @@ public class CodeClimateRendererTest extends AbstractRendererTst {
@Override @Override
public String getExpected() { public String getExpected() {
return "{\"type\":\"issue\",\"check_name\":\"Foo\",\"description\":\"blah\",\"content\":{\"body\":\"desc\"},\"categories\":[\"Style\"],\"location\":{\"path\":\"n/a\",\"lines\":{\"begin\":1,\"end\":1}},\"severity\":\"info\"}" + PMD.EOL; return "{\"type\":\"issue\",\"check_name\":\"Foo\",\"description\":\"blah\",\"content\":{\"body\":\"desc\"},\"categories\":[\"Style\"],\"location\":{\"path\":\"n/a\",\"lines\":{\"begin\":1,\"end\":1}},\"severity\":\"info\",\"remediation_points\":50000}" + "\u0000" + PMD.EOL;
} }
@Override @Override
@ -24,8 +24,8 @@ public class CodeClimateRendererTest extends AbstractRendererTst {
@Override @Override
public String getExpectedMultiple() { public String getExpectedMultiple() {
return "{\"type\":\"issue\",\"check_name\":\"Foo\",\"description\":\"blah\",\"content\":{\"body\":\"desc\"},\"categories\":[\"Style\"],\"location\":{\"path\":\"n/a\",\"lines\":{\"begin\":1,\"end\":1}},\"severity\":\"info\"}" + PMD.EOL + return "{\"type\":\"issue\",\"check_name\":\"Foo\",\"description\":\"blah\",\"content\":{\"body\":\"desc\"},\"categories\":[\"Style\"],\"location\":{\"path\":\"n/a\",\"lines\":{\"begin\":1,\"end\":1}},\"severity\":\"info\",\"remediation_points\":50000}" + "\u0000" + PMD.EOL +
"{\"type\":\"issue\",\"check_name\":\"Foo\",\"description\":\"blah\",\"content\":{\"body\":\"desc\"},\"categories\":[\"Style\"],\"location\":{\"path\":\"n/a\",\"lines\":{\"begin\":1,\"end\":1}},\"severity\":\"info\"}" + PMD.EOL; "{\"type\":\"issue\",\"check_name\":\"Foo\",\"description\":\"blah\",\"content\":{\"body\":\"desc\"},\"categories\":[\"Style\"],\"location\":{\"path\":\"n/a\",\"lines\":{\"begin\":1,\"end\":1}},\"severity\":\"info\",\"remediation_points\":50000}" + "\u0000" + PMD.EOL;
} }
public static junit.framework.Test suite() { public static junit.framework.Test suite() {