X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;ds=sidebyside;f=src%2Ftest%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ffreenet%2Fwot%2FIdentityChangeEventSenderTest.java;h=ff442a41762933864ded02bfe5c5d9fecce98c07;hb=110a933c2724aba6a604fc5eed6372ff1e1e6144;hp=fe4f07042708ee9e57973633e88b7923ddb87c00;hpb=4c4b77eff97fd247c6b1c8bbb30aeb6ea3d2c172;p=Sone.git
diff --git a/src/test/java/net/pterodactylus/sone/freenet/wot/IdentityChangeEventSenderTest.java b/src/test/java/net/pterodactylus/sone/freenet/wot/IdentityChangeEventSenderTest.java
index fe4f070..ff442a4 100644
--- a/src/test/java/net/pterodactylus/sone/freenet/wot/IdentityChangeEventSenderTest.java
+++ b/src/test/java/net/pterodactylus/sone/freenet/wot/IdentityChangeEventSenderTest.java
@@ -1,5 +1,5 @@
/*
- * Sone - IdentityChangeEventSenderTest.java - Copyright © 2013 David Roden
+ * Sone - IdentityChangeEventSenderTest.java - Copyright © 2013â2019 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
@@ -21,12 +21,15 @@ import static com.google.common.collect.ImmutableMap.of;
import static java.util.Arrays.asList;
import static net.pterodactylus.sone.freenet.wot.Identities.createIdentity;
import static net.pterodactylus.sone.freenet.wot.Identities.createOwnIdentity;
-import static org.mockito.Matchers.eq;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
+import java.util.Collection;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import net.pterodactylus.sone.freenet.wot.event.IdentityAddedEvent;
import net.pterodactylus.sone.freenet.wot.event.IdentityRemovedEvent;
@@ -34,15 +37,11 @@ import net.pterodactylus.sone.freenet.wot.event.IdentityUpdatedEvent;
import net.pterodactylus.sone.freenet.wot.event.OwnIdentityAddedEvent;
import net.pterodactylus.sone.freenet.wot.event.OwnIdentityRemovedEvent;
-import com.google.common.collect.ImmutableMultimap;
-import com.google.common.collect.Multimap;
import com.google.common.eventbus.EventBus;
import org.junit.Test;
/**
* Unit test for {@link IdentityChangeEventSender}.
- *
- * @author David âBombeâ Roden
*/
public class IdentityChangeEventSenderTest {
@@ -62,7 +61,7 @@ public class IdentityChangeEventSenderTest {
@Test
public void addingAnOwnIdentityIsDetectedAndReportedCorrectly() {
- Multimap newIdentities = createNewIdentities();
+ Map> newIdentities = createNewIdentities();
identityChangeEventSender.detectChanges(newIdentities);
verify(eventBus).post(eq(new OwnIdentityRemovedEvent(ownIdentities.get(0))));
verify(eventBus).post(eq(new IdentityRemovedEvent(ownIdentities.get(0), identities.get(0))));
@@ -75,22 +74,18 @@ public class IdentityChangeEventSenderTest {
verify(eventBus).post(eq(new IdentityUpdatedEvent(ownIdentities.get(1), identities.get(1))));
}
- private Multimap createNewIdentities() {
- ImmutableMultimap.Builder oldIdentities = ImmutableMultimap.builder();
- oldIdentities.put(ownIdentities.get(1), identities.get(3));
- oldIdentities.put(ownIdentities.get(1), identities.get(2));
- oldIdentities.put(ownIdentities.get(2), identities.get(1));
- oldIdentities.put(ownIdentities.get(2), identities.get(2));
- return oldIdentities.build();
+ private Map> createNewIdentities() {
+ Map> oldIdentities = new HashMap<>();
+ oldIdentities.put(ownIdentities.get(1), asList(identities.get(3), identities.get(2)));
+ oldIdentities.put(ownIdentities.get(2), asList(identities.get(1), identities.get(2)));
+ return oldIdentities;
}
- private Multimap createOldIdentities() {
- ImmutableMultimap.Builder oldIdentities = ImmutableMultimap.builder();
- oldIdentities.put(ownIdentities.get(0), identities.get(0));
- oldIdentities.put(ownIdentities.get(0), identities.get(1));
- oldIdentities.put(ownIdentities.get(1), identities.get(0));
- oldIdentities.put(ownIdentities.get(1), identities.get(1));
- return oldIdentities.build();
+ private Map> createOldIdentities() {
+ Map> oldIdentities = new HashMap<>();
+ oldIdentities.put(ownIdentities.get(0), asList(identities.get(0), identities.get(1)));
+ oldIdentities.put(ownIdentities.get(1), asList(identities.get(0), identities.get(1)));
+ return oldIdentities;
}
}