aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api/src/test/java/org/sonar/api/rule/RuleKeyTest.java
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2013-04-17 18:29:35 +0200
committerSimon Brandhof <simon.brandhof@gmail.com>2013-04-17 18:36:56 +0200
commit7660b174b186527b5df5354295886c42dec2109d (patch)
tree0ed5f14607232f9161741a486e5d67ca48440e93 /sonar-plugin-api/src/test/java/org/sonar/api/rule/RuleKeyTest.java
parent398c82a5810e446a22b31d204a87ad7fd806a068 (diff)
downloadsonarqube-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.java40
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();