Add unit tests for identity events.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 12 Nov 2013 06:05:06 +0000 (07:05 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 28 Feb 2014 21:26:00 +0000 (22:26 +0100)
src/test/java/net/pterodactylus/sone/freenet/wot/event/IdentityAddedEventTest.java [new file with mode: 0644]
src/test/java/net/pterodactylus/sone/freenet/wot/event/IdentityRemovedEventTest.java [new file with mode: 0644]
src/test/java/net/pterodactylus/sone/freenet/wot/event/IdentityUpdatedEventTest.java [new file with mode: 0644]
src/test/java/net/pterodactylus/sone/freenet/wot/event/OwnIdentityAddedEventTest.java [new file with mode: 0644]
src/test/java/net/pterodactylus/sone/freenet/wot/event/OwnIdentityRemovedEventTest.java [new file with mode: 0644]

diff --git a/src/test/java/net/pterodactylus/sone/freenet/wot/event/IdentityAddedEventTest.java b/src/test/java/net/pterodactylus/sone/freenet/wot/event/IdentityAddedEventTest.java
new file mode 100644 (file)
index 0000000..e4a6ecb
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Sone - IdentityAddedEventTest.java - Copyright © 2013 David Roden
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package net.pterodactylus.sone.freenet.wot.event;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.mockito.Mockito.mock;
+
+import net.pterodactylus.sone.freenet.wot.Identity;
+import net.pterodactylus.sone.freenet.wot.OwnIdentity;
+
+import org.junit.Test;
+
+/**
+ * Unit test for {@link IdentityAddedEvent}.
+ *
+ * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
+ */
+public class IdentityAddedEventTest {
+
+       @Test
+       public void eventStoresAndReturnsIdentities() {
+               OwnIdentity ownIdentity = mock(OwnIdentity.class);
+               Identity identity = mock(Identity.class);
+               IdentityAddedEvent identityAddedEvent = new IdentityAddedEvent(ownIdentity, identity);
+               assertThat(identityAddedEvent.ownIdentity(), is(ownIdentity));
+               assertThat(identityAddedEvent.identity(), is(identity));
+       }
+
+}
diff --git a/src/test/java/net/pterodactylus/sone/freenet/wot/event/IdentityRemovedEventTest.java b/src/test/java/net/pterodactylus/sone/freenet/wot/event/IdentityRemovedEventTest.java
new file mode 100644 (file)
index 0000000..7f46dd9
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Sone - IdentityRemovedEventTest.java - Copyright © 2013 David Roden
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package net.pterodactylus.sone.freenet.wot.event;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.mockito.Mockito.mock;
+
+import net.pterodactylus.sone.freenet.wot.Identity;
+import net.pterodactylus.sone.freenet.wot.OwnIdentity;
+
+import org.junit.Test;
+
+/**
+ * Unit test for {@link IdentityRemovedEvent}.
+ *
+ * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
+ */
+public class IdentityRemovedEventTest {
+
+       @Test
+       public void eventStoresAndReturnsIdentities() {
+               OwnIdentity ownIdentity = mock(OwnIdentity.class);
+               Identity identity = mock(Identity.class);
+               IdentityRemovedEvent identityRemovedEvent = new IdentityRemovedEvent(ownIdentity, identity);
+               assertThat(identityRemovedEvent.ownIdentity(), is(ownIdentity));
+               assertThat(identityRemovedEvent.identity(), is(identity));
+       }
+
+}
diff --git a/src/test/java/net/pterodactylus/sone/freenet/wot/event/IdentityUpdatedEventTest.java b/src/test/java/net/pterodactylus/sone/freenet/wot/event/IdentityUpdatedEventTest.java
new file mode 100644 (file)
index 0000000..881991e
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Sone - IdentityUpdatedEventTest.java - Copyright © 2013 David Roden
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package net.pterodactylus.sone.freenet.wot.event;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.mockito.Mockito.mock;
+
+import net.pterodactylus.sone.freenet.wot.Identity;
+import net.pterodactylus.sone.freenet.wot.OwnIdentity;
+
+import org.junit.Test;
+
+/**
+ * Unit test for {@link IdentityUpdatedEvent}.
+ *
+ * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
+ */
+public class IdentityUpdatedEventTest {
+
+       @Test
+       public void eventStoresAndReturnsIdentities() {
+               OwnIdentity ownIdentity = mock(OwnIdentity.class);
+               Identity identity = mock(Identity.class);
+               IdentityUpdatedEvent identityUpdatedEvent = new IdentityUpdatedEvent(ownIdentity, identity);
+               assertThat(identityUpdatedEvent.ownIdentity(), is(ownIdentity));
+               assertThat(identityUpdatedEvent.identity(), is(identity));
+       }
+
+}
diff --git a/src/test/java/net/pterodactylus/sone/freenet/wot/event/OwnIdentityAddedEventTest.java b/src/test/java/net/pterodactylus/sone/freenet/wot/event/OwnIdentityAddedEventTest.java
new file mode 100644 (file)
index 0000000..1a7c925
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Sone - OwnIdentityAddedEventTest.java - Copyright © 2013 David Roden
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package net.pterodactylus.sone.freenet.wot.event;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.mockito.Mockito.mock;
+
+import net.pterodactylus.sone.freenet.wot.OwnIdentity;
+
+import org.junit.Test;
+
+/**
+ * Unit test for {@link OwnIdentityAddedEvent}.
+ *
+ * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
+ */
+public class OwnIdentityAddedEventTest {
+
+       @Test
+       public void eventStoresAndReturnsOwnIdentity() {
+               OwnIdentity ownIdentity = mock(OwnIdentity.class);
+               OwnIdentityAddedEvent ownIdentityAddedEvent = new OwnIdentityAddedEvent(ownIdentity);
+               assertThat(ownIdentityAddedEvent.ownIdentity(), is(ownIdentity));
+       }
+
+}
diff --git a/src/test/java/net/pterodactylus/sone/freenet/wot/event/OwnIdentityRemovedEventTest.java b/src/test/java/net/pterodactylus/sone/freenet/wot/event/OwnIdentityRemovedEventTest.java
new file mode 100644 (file)
index 0000000..4cb5f86
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Sone - OwnIdentityRemovedEventTest.java - Copyright © 2013 David Roden
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package net.pterodactylus.sone.freenet.wot.event;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.mockito.Mockito.mock;
+
+import net.pterodactylus.sone.freenet.wot.OwnIdentity;
+
+import org.junit.Test;
+
+/**
+ * Unit test for {@link OwnIdentityRemovedEvent}.
+ *
+ * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
+ */
+public class OwnIdentityRemovedEventTest {
+
+       @Test
+       public void eventStoresAndReturnsOwnIdentity() {
+               OwnIdentity ownIdentity = mock(OwnIdentity.class);
+               OwnIdentityRemovedEvent ownIdentityRemovedEvent = new OwnIdentityRemovedEvent(ownIdentity);
+               assertThat(ownIdentityRemovedEvent.ownIdentity(), is(ownIdentity));
+       }
+
+}