diff options
author | Jean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com> | 2014-03-13 15:33:07 +0100 |
---|---|---|
committer | Jean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com> | 2014-03-13 16:16:21 +0100 |
commit | 1c2545e146ab0067c928363b62a57d7a206f22b3 (patch) | |
tree | 9e7a53e6da56bf899a35ee139b05e85bacca8ce8 /sonar-plugin-api/src/test/java/org | |
parent | 4d75df2feac832421fa6e6b54167e441f1e51836 (diff) | |
download | sonarqube-1c2545e146ab0067c928363b62a57d7a206f22b3.tar.gz sonarqube-1c2545e146ab0067c928363b62a57d7a206f22b3.zip |
SONAR-4366 Remove Alert class and related code
Diffstat (limited to 'sonar-plugin-api/src/test/java/org')
-rw-r--r-- | sonar-plugin-api/src/test/java/org/sonar/api/profiles/XMLProfileParserTest.java | 31 | ||||
-rw-r--r-- | sonar-plugin-api/src/test/java/org/sonar/api/profiles/XMLProfileSerializerTest.java | 14 |
2 files changed, 0 insertions, 45 deletions
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/profiles/XMLProfileParserTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/profiles/XMLProfileParserTest.java index 4b4173fa262..7913751ccaa 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/profiles/XMLProfileParserTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/profiles/XMLProfileParserTest.java @@ -82,37 +82,6 @@ public class XMLProfileParserTest { assertThat(rule.getParameter("unknown")).isNull(); } - @Test - public void importProfileWithAlerts() { - ValidationMessages validation = ValidationMessages.create(); - RulesProfile profile = parse("importProfileWithAlerts.xml", validation); - - assertThat(profile.getAlerts()).hasSize(2); - - Alert alert = profile.getAlerts().get(0); - assertThat(alert.getMetric().getKey()).isEqualTo("lines"); - assertThat(alert.getOperator()).isEqualTo(Alert.OPERATOR_SMALLER); - assertThat(alert.getValueWarning()).isEqualTo("0"); - assertThat(alert.getValueError()).isEqualTo("10"); - assertThat(alert.getPeriod()).isNull(); - - alert = profile.getAlerts().get(1); - assertThat(alert.getMetric().getKey()).isEqualTo("complexity"); - assertThat(alert.getOperator()).isEqualTo(Alert.OPERATOR_GREATER); - assertThat(alert.getValueWarning()).isEqualTo("10"); - assertThat(alert.getValueError()).isEqualTo("12"); - assertThat(alert.getPeriod()).isEqualTo(1); - } - - @Test - public void shouldNotFailWhenNoMetricFinder() { - ValidationMessages validation = ValidationMessages.create(); - RulesProfile profile = new XMLProfileParser(newRuleFinder(), null) - .parseResource(getClass().getClassLoader(), getResourcePath("importProfileWithAlerts.xml"), validation); - - assertThat(profile.getAlerts()).isEmpty(); - } - private RulesProfile parse(String resource, ValidationMessages validation) { return new XMLProfileParser(newRuleFinder(), newMetricFinder()) .parseResource(getClass().getClassLoader(), getResourcePath(resource), validation); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/profiles/XMLProfileSerializerTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/profiles/XMLProfileSerializerTest.java index 118ac0d54fe..2a96d5fedaf 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/profiles/XMLProfileSerializerTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/profiles/XMLProfileSerializerTest.java @@ -77,20 +77,6 @@ public class XMLProfileSerializerTest { assertSimilarXml("exportRuleParameters.xml", writer.toString()); } - @Test - public void exportAlerts() throws Exception { - Writer writer = new StringWriter(); - RulesProfile profile = RulesProfile.create("sonar way", "java"); - List<Alert> alerts = profile.getAlerts(); - Alert alert1 = new Alert(profile, new Metric("coverage"), Alert.OPERATOR_SMALLER, "60", "80"); - alerts.add(alert1); - Alert alert2 = new Alert(profile, new Metric("complexity"), Alert.OPERATOR_GREATER, "12", "10", 1); - alerts.add(alert2); - new XMLProfileSerializer().write(profile, writer); - - assertSimilarXml("exportAlerts.xml", writer.toString()); - } - public static void assertSimilarXml(String fileWithExpectedXml, String xml) throws IOException, SAXException { String pathToExpectedXml = "/org/sonar/api/profiles/XMLProfileSerializerTest/" + fileWithExpectedXml; InputStream stream = XMLProfileSerializerTest.class.getResourceAsStream(pathToExpectedXml); |