diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2013-04-17 18:29:35 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2013-04-17 18:36:56 +0200 |
commit | 7660b174b186527b5df5354295886c42dec2109d (patch) | |
tree | 0ed5f14607232f9161741a486e5d67ca48440e93 /sonar-plugin-api/src/test/java/org/sonar/api/rule/RuleKeyTest.java | |
parent | 398c82a5810e446a22b31d204a87ad7fd806a068 (diff) | |
download | sonarqube-7660b174b186527b5df5354295886c42dec2109d.tar.gz sonarqube-7660b174b186527b5df5354295886c42dec2109d.zip |
SONAR-3755 support the parameter "rules" in /api/issues/search
Diffstat (limited to 'sonar-plugin-api/src/test/java/org/sonar/api/rule/RuleKeyTest.java')
-rw-r--r-- | sonar-plugin-api/src/test/java/org/sonar/api/rule/RuleKeyTest.java | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/rule/RuleKeyTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/rule/RuleKeyTest.java index d4411fb860f..aee99313bbc 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/rule/RuleKeyTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/rule/RuleKeyTest.java @@ -33,6 +33,46 @@ public class RuleKeyTest { } @Test + public void repository_must_not_be_null() throws Exception { + try { + RuleKey.of(null, "NullDeref"); + fail(); + } catch (IllegalArgumentException e) { + assertThat(e).hasMessage("Repository must be set"); + } + } + + @Test + public void repository_must_not_be_empty() throws Exception { + try { + RuleKey.of("", "NullDeref"); + fail(); + } catch (IllegalArgumentException e) { + assertThat(e).hasMessage("Repository must be set"); + } + } + + @Test + public void rule_must_not_be_null() throws Exception { + try { + RuleKey.of("squid", null); + fail(); + } catch (IllegalArgumentException e) { + assertThat(e).hasMessage("Rule must be set"); + } + } + + @Test + public void rule_must_not_be_empty() throws Exception { + try { + RuleKey.of("squid", ""); + fail(); + } catch (IllegalArgumentException e) { + assertThat(e).hasMessage("Rule must be set"); + } + } + + @Test public void should_encode_and_decode_string() throws Exception { RuleKey key = RuleKey.of("squid", "NullDeref"); String serialized = key.toString(); |