From f8fab0f886a2809db0e5888e110db154c69df7c9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 12 Nov 2013 07:05:06 +0100 Subject: [PATCH] Add unit tests for identity events. --- .../freenet/wot/event/IdentityAddedEventTest.java | 45 ++++++++++++++++++++++ .../wot/event/IdentityRemovedEventTest.java | 45 ++++++++++++++++++++++ .../wot/event/IdentityUpdatedEventTest.java | 45 ++++++++++++++++++++++ .../wot/event/OwnIdentityAddedEventTest.java | 42 ++++++++++++++++++++ .../wot/event/OwnIdentityRemovedEventTest.java | 42 ++++++++++++++++++++ 5 files changed, 219 insertions(+) create mode 100644 src/test/java/net/pterodactylus/sone/freenet/wot/event/IdentityAddedEventTest.java create mode 100644 src/test/java/net/pterodactylus/sone/freenet/wot/event/IdentityRemovedEventTest.java create mode 100644 src/test/java/net/pterodactylus/sone/freenet/wot/event/IdentityUpdatedEventTest.java create mode 100644 src/test/java/net/pterodactylus/sone/freenet/wot/event/OwnIdentityAddedEventTest.java create mode 100644 src/test/java/net/pterodactylus/sone/freenet/wot/event/OwnIdentityRemovedEventTest.java 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 index 0000000..e4a6ecb --- /dev/null +++ b/src/test/java/net/pterodactylus/sone/freenet/wot/event/IdentityAddedEventTest.java @@ -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 . + */ + +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 David ‘Bombe’ Roden + */ +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 index 0000000..7f46dd9 --- /dev/null +++ b/src/test/java/net/pterodactylus/sone/freenet/wot/event/IdentityRemovedEventTest.java @@ -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 . + */ + +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 David ‘Bombe’ Roden + */ +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 index 0000000..881991e --- /dev/null +++ b/src/test/java/net/pterodactylus/sone/freenet/wot/event/IdentityUpdatedEventTest.java @@ -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 . + */ + +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 David ‘Bombe’ Roden + */ +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 index 0000000..1a7c925 --- /dev/null +++ b/src/test/java/net/pterodactylus/sone/freenet/wot/event/OwnIdentityAddedEventTest.java @@ -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 . + */ + +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 David ‘Bombe’ Roden + */ +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 index 0000000..4cb5f86 --- /dev/null +++ b/src/test/java/net/pterodactylus/sone/freenet/wot/event/OwnIdentityRemovedEventTest.java @@ -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 . + */ + +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 David ‘Bombe’ Roden + */ +public class OwnIdentityRemovedEventTest { + + @Test + public void eventStoresAndReturnsOwnIdentity() { + OwnIdentity ownIdentity = mock(OwnIdentity.class); + OwnIdentityRemovedEvent ownIdentityRemovedEvent = new OwnIdentityRemovedEvent(ownIdentity); + assertThat(ownIdentityRemovedEvent.ownIdentity(), is(ownIdentity)); + } + +} -- 2.7.4