aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorEvgeny Mandrikov <mandrikov@gmail.com>2011-07-27 18:35:42 +0400
committerEvgeny Mandrikov <mandrikov@gmail.com>2011-07-28 06:06:02 +0400
commitb0e768ada85207c3ac6424b069e0dbc4e162c9db (patch)
tree48e6709ae5d60d084c3d58a4701efeca8c890597 /sonar-plugin-api
parent223cc999564d32633fbdc493e11556e8a29e2d8b (diff)
downloadsonarqube-b0e768ada85207c3ac6424b069e0dbc4e162c9db.tar.gz
sonarqube-b0e768ada85207c3ac6424b069e0dbc4e162c9db.zip
SONAR-2596 Add unit tests
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/notifications/NotificationChannelTest.java42
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/notifications/NotificationDispatcherTest.java42
2 files changed, 84 insertions, 0 deletions
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/notifications/NotificationChannelTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/notifications/NotificationChannelTest.java
new file mode 100644
index 00000000000..788442341aa
--- /dev/null
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/notifications/NotificationChannelTest.java
@@ -0,0 +1,42 @@
+/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2008-2011 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * Sonar is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * Sonar is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Sonar; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+ */
+package org.sonar.api.notifications;
+
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+
+import org.junit.Test;
+
+public class NotificationChannelTest {
+
+ @Test
+ public void defaultMethods() {
+ NotificationChannel channel = new FakeNotificationChannel();
+ assertThat(channel.getKey(), is("FakeNotificationChannel"));
+ assertThat(channel.toString(), is("FakeNotificationChannel"));
+ }
+
+ class FakeNotificationChannel extends NotificationChannel {
+ @Override
+ public void deliver(Notification notification, String username) {
+ }
+ }
+
+}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/notifications/NotificationDispatcherTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/notifications/NotificationDispatcherTest.java
new file mode 100644
index 00000000000..4ea8e86f347
--- /dev/null
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/notifications/NotificationDispatcherTest.java
@@ -0,0 +1,42 @@
+/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2008-2011 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * Sonar is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * Sonar is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Sonar; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+ */
+package org.sonar.api.notifications;
+
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+
+import org.junit.Test;
+
+public class NotificationDispatcherTest {
+
+ @Test
+ public void defaultMethods() {
+ NotificationDispatcher channel = new FakeNotificationDispatcher();
+ assertThat(channel.getKey(), is("FakeNotificationDispatcher"));
+ assertThat(channel.toString(), is("FakeNotificationDispatcher"));
+ }
+
+ class FakeNotificationDispatcher extends NotificationDispatcher {
+ @Override
+ public void dispatch(Notification notification, Context context) {
+ }
+ }
+
+}