private List<Violation> createViolations() {
List<Violation> violations = new ArrayList<Violation>();
- violations.add(Violation.create(ruleA1, resource).setPriority(RulePriority.CRITICAL));
- violations.add(Violation.create(ruleA1, resource).setPriority(RulePriority.CRITICAL));
- violations.add(Violation.create(ruleA2, resource).setPriority(RulePriority.MAJOR));
- violations.add(Violation.create(ruleB1, resource).setPriority(RulePriority.MINOR));
+ violations.add(Violation.create(ruleA1, resource).setSeverity(RulePriority.CRITICAL));
+ violations.add(Violation.create(ruleA1, resource).setSeverity(RulePriority.CRITICAL));
+ violations.add(Violation.create(ruleA2, resource).setSeverity(RulePriority.MAJOR));
+ violations.add(Violation.create(ruleB1, resource).setSeverity(RulePriority.MINOR));
return violations;
}
}
@Test
public void shouldClearCacheAfterExecution() {
- Violation violation1 = Violation.create(rule1, resource).setPriority(RulePriority.CRITICAL).setCreatedAt(rightNow);
- Violation violation2 = Violation.create(rule2, resource).setPriority(RulePriority.CRITICAL).setCreatedAt(rightNow);
+ Violation violation1 = Violation.create(rule1, resource).setSeverity(RulePriority.CRITICAL).setCreatedAt(rightNow);
+ Violation violation2 = Violation.create(rule2, resource).setSeverity(RulePriority.CRITICAL).setCreatedAt(rightNow);
when(context.getViolations()).thenReturn(Arrays.asList(violation1)).thenReturn(Arrays.asList(violation2));
decorator.decorate(resource, context);
private List<Violation> createViolations() {
List<Violation> violations = new ArrayList<Violation>();
- violations.add(Violation.create(rule1, resource).setPriority(RulePriority.CRITICAL).setCreatedAt(rightNow));
- violations.add(Violation.create(rule1, resource).setPriority(RulePriority.CRITICAL).setCreatedAt(tenDaysAgo));
- violations.add(Violation.create(rule2, resource).setPriority(RulePriority.MAJOR).setCreatedAt(fiveDaysAgo));
- violations.add(Violation.create(rule2, resource).setPriority(RulePriority.MAJOR).setCreatedAt(tenDaysAgo));
- violations.add(Violation.create(rule3, resource).setPriority(RulePriority.MINOR).setCreatedAt(fiveDaysAgo));
- violations.add(Violation.create(rule3, resource).setPriority(RulePriority.MINOR).setCreatedAt(tenDaysAgo));
+ violations.add(Violation.create(rule1, resource).setSeverity(RulePriority.CRITICAL).setCreatedAt(rightNow));
+ violations.add(Violation.create(rule1, resource).setSeverity(RulePriority.CRITICAL).setCreatedAt(tenDaysAgo));
+ violations.add(Violation.create(rule2, resource).setSeverity(RulePriority.MAJOR).setCreatedAt(fiveDaysAgo));
+ violations.add(Violation.create(rule2, resource).setSeverity(RulePriority.MAJOR).setCreatedAt(tenDaysAgo));
+ violations.add(Violation.create(rule3, resource).setSeverity(RulePriority.MINOR).setCreatedAt(fiveDaysAgo));
+ violations.add(Violation.create(rule3, resource).setSeverity(RulePriority.MINOR).setCreatedAt(tenDaysAgo));
return violations;
}
*/
package org.sonar.java.ast.visitor;
-import static org.junit.Assert.assertEquals;
-import static org.sonar.java.ast.SquidTestUtils.getFile;
-
import org.junit.Test;
import org.sonar.java.ast.JavaAstScanner;
import org.sonar.java.squid.JavaSquidConfiguration;
import org.sonar.squid.Squid;
import org.sonar.squid.api.SourceCode;
-import org.sonar.squid.api.SquidConfiguration;
import org.sonar.squid.measures.Metric;
+import static org.junit.Assert.assertEquals;
+import static org.sonar.java.ast.SquidTestUtils.getFile;
+
public class AccessorVisitorTest {
private Squid squid;
package org.sonar.plugins.squid.bridges;\r
\r
import org.junit.Test;\r
-import static org.mockito.Mockito.verify;\r
-import static org.mockito.Mockito.never;\r
-import static org.mockito.Matchers.*;\r
-import org.sonar.api.resources.JavaPackage;\r
-import org.sonar.api.resources.JavaFile;\r
import org.sonar.api.measures.CoreMetrics;\r
import org.sonar.api.measures.Measure;\r
+import org.sonar.api.resources.JavaFile;\r
+import org.sonar.api.resources.JavaPackage;\r
import org.sonar.api.test.IsMeasure;\r
-import static org.hamcrest.Matchers.any;\r
\r
-public class FunctionComplexityDistributionBridgeTest extends BridgeTestCase{\r
+import static org.mockito.Matchers.argThat;\r
+import static org.mockito.Matchers.eq;\r
+import static org.mockito.Mockito.never;\r
+import static org.mockito.Mockito.verify;\r
+\r
+public class FunctionComplexityDistributionBridgeTest extends BridgeTestCase {\r
\r
@Test\r
public void functionComplexityDistribution() {\r
}
} else {
- violation.setPriority(activeRule.getSeverity());
+ violation.setSeverity(activeRule.getSeverity());
doAddViolation(violation, bucket);
}
}
@Test
public void shouldSaveViolations() {
Violation violation1a = Violation.create(rule1, javaFile)
- .setPriority(RulePriority.CRITICAL).setLineId(20).setCost(55.6)
+ .setSeverity(RulePriority.CRITICAL).setLineId(20).setCost(55.6)
.setMessage("the message");
Violation violation1b = Violation.create(rule1, javaFile)
- .setPriority(RulePriority.CRITICAL).setLineId(50).setCost(80.0);
+ .setSeverity(RulePriority.CRITICAL).setLineId(50).setCost(80.0);
Violation violation2 = Violation.create(rule2, javaFile)
- .setPriority(RulePriority.MINOR);
+ .setSeverity(RulePriority.MINOR);
Project project = new Project("project");
violationPersister.saveViolation(project, violation1a);
Violation violation = Violation.create(new Rule(check.getRepositoryKey(), check.getTemplateKey()), resource);
violation.setLineId(message.getLine());
violation.setMessage(message.getText(Locale.ENGLISH));
- violation.setPriority(RulePriority.fromCheckPriority(check.getPriority()));
+ violation.setSeverity(RulePriority.fromCheckPriority(check.getPriority()));
context.saveViolation(violation);
}
checksByChecker.clear();
}
-}
\ No newline at end of file
+}