From b0e768ada85207c3ac6424b069e0dbc4e162c9db Mon Sep 17 00:00:00 2001 From: Evgeny Mandrikov Date: Wed, 27 Jul 2011 18:35:42 +0400 Subject: SONAR-2596 Add unit tests --- .../api/notifications/NotificationChannelTest.java | 42 ++++++++++++++++++++++ .../notifications/NotificationDispatcherTest.java | 42 ++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 sonar-plugin-api/src/test/java/org/sonar/api/notifications/NotificationChannelTest.java create mode 100644 sonar-plugin-api/src/test/java/org/sonar/api/notifications/NotificationDispatcherTest.java (limited to 'sonar-plugin-api') 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) { + } + } + +} -- cgit v1.2.3