From 8c46c562753c6cff5510f2d628b5adc4f315ffa2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Mon, 23 Sep 2019 21:36:43 +0200 Subject: [PATCH] =?utf8?q?=F0=9F=8E=A8=20Use=20nullable=20type=20instead?= =?utf8?q?=20of=20optional?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../sone/core/SoneModificationDetector.java | 12 +-- .../pterodactylus/sone/data/impl/AlbumImpl.java | 52 +++++------ .../pterodactylus/sone/data/impl/ImageImpl.java | 101 ++++++++++----------- .../sone/freenet/wot/IdentityLoader.java | 21 ++--- .../sone/freenet/wot/WebOfTrustConnector.java | 8 +- .../sone/freenet/wot/IdentityManagerTest.java | 2 +- .../java/net/pterodactylus/sone/test/Matchers.java | 21 +++-- .../sone/core/ConfigurationSoneParserTest.kt | 6 +- .../sone/database/memory/MemoryDatabaseTest.kt | 4 +- .../sone/freenet/wot/IdentityLoaderTest.kt | 16 ++-- 10 files changed, 114 insertions(+), 129 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/core/SoneModificationDetector.java b/src/main/java/net/pterodactylus/sone/core/SoneModificationDetector.java index 92fa3dc..e5e20d9 100644 --- a/src/main/java/net/pterodactylus/sone/core/SoneModificationDetector.java +++ b/src/main/java/net/pterodactylus/sone/core/SoneModificationDetector.java @@ -24,7 +24,7 @@ class SoneModificationDetector { private final Ticker ticker; private final LockableFingerprintProvider lockableFingerprintProvider; private final AtomicInteger insertionDelay; - private Optional lastModificationTime; + private Long lastModificationTime; private String lastInsertFingerprint; private String lastCheckFingerprint; @@ -42,18 +42,18 @@ class SoneModificationDetector { public boolean isEligibleForInsert() { if (lockableFingerprintProvider.isLocked()) { - lastModificationTime = absent(); + lastModificationTime = null; lastCheckFingerprint = ""; return false; } String fingerprint = lockableFingerprintProvider.getFingerprint(); if (fingerprint.equals(lastInsertFingerprint)) { - lastModificationTime = absent(); + lastModificationTime = null; lastCheckFingerprint = fingerprint; return false; } if (!Objects.equal(lastCheckFingerprint, fingerprint)) { - lastModificationTime = of(ticker.read()); + lastModificationTime = ticker.read(); lastCheckFingerprint = fingerprint; return false; } @@ -67,11 +67,11 @@ class SoneModificationDetector { public void setFingerprint(String fingerprint) { lastInsertFingerprint = fingerprint; lastCheckFingerprint = lastInsertFingerprint; - lastModificationTime = absent(); + lastModificationTime = null; } private boolean insertionDelayHasPassed() { - return NANOSECONDS.toSeconds(ticker.read() - lastModificationTime.get()) >= insertionDelay.get(); + return NANOSECONDS.toSeconds(ticker.read() - lastModificationTime) >= insertionDelay.get(); } public boolean isModified() { diff --git a/src/main/java/net/pterodactylus/sone/data/impl/AlbumImpl.java b/src/main/java/net/pterodactylus/sone/data/impl/AlbumImpl.java index 3ec362f..a8768e1 100644 --- a/src/main/java/net/pterodactylus/sone/data/impl/AlbumImpl.java +++ b/src/main/java/net/pterodactylus/sone/data/impl/AlbumImpl.java @@ -17,28 +17,17 @@ package net.pterodactylus.sone.data.impl; -import static com.google.common.base.Optional.absent; -import static com.google.common.base.Optional.fromNullable; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; -import static java.nio.charset.StandardCharsets.UTF_8; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import net.pterodactylus.sone.data.Album; -import net.pterodactylus.sone.data.Image; -import net.pterodactylus.sone.data.Sone; - -import com.google.common.base.Function; -import com.google.common.base.Optional; -import com.google.common.base.Predicates; -import com.google.common.collect.Collections2; -import com.google.common.hash.Hasher; +import java.util.*; +import javax.annotation.*; + +import com.google.common.base.*; +import com.google.common.collect.*; import com.google.common.hash.Hashing; +import com.google.common.hash.*; +import net.pterodactylus.sone.data.*; + +import static com.google.common.base.Preconditions.*; +import static java.nio.charset.StandardCharsets.*; /** * Container for images that can also contain nested {@link AlbumImpl}s. @@ -258,32 +247,33 @@ public class AlbumImpl implements Album { public Modifier modify() throws IllegalStateException { // TODO: reenable check for local Sones return new Modifier() { - private Optional title = absent(); - - private Optional description = absent(); + @Nullable + private String title; + @Nullable + private String description; @Override public Modifier setTitle(String title) { - this.title = fromNullable(title); + this.title = title; return this; } @Override public Modifier setDescription(String description) { - this.description = fromNullable(description); + this.description = description; return this; } @Override public Album update() throws IllegalStateException { - if (title.isPresent() && title.get().trim().isEmpty()) { + if (title != null && title.trim().isEmpty()) { throw new AlbumTitleMustNotBeEmpty(); } - if (title.isPresent()) { - AlbumImpl.this.title = title.get(); + if (title != null) { + AlbumImpl.this.title = title; } - if (description.isPresent()) { - AlbumImpl.this.description = description.get(); + if (description != null) { + AlbumImpl.this.description = description; } return AlbumImpl.this; } diff --git a/src/main/java/net/pterodactylus/sone/data/impl/ImageImpl.java b/src/main/java/net/pterodactylus/sone/data/impl/ImageImpl.java index a54a8de..b357b6a 100644 --- a/src/main/java/net/pterodactylus/sone/data/impl/ImageImpl.java +++ b/src/main/java/net/pterodactylus/sone/data/impl/ImageImpl.java @@ -16,22 +16,14 @@ */ package net.pterodactylus.sone.data.impl; -import static com.google.common.base.Optional.absent; -import static com.google.common.base.Optional.fromNullable; -import static com.google.common.base.Optional.of; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Preconditions.checkState; -import static java.nio.charset.StandardCharsets.UTF_8; +import java.util.*; +import javax.annotation.*; -import java.util.UUID; +import com.google.common.hash.*; +import net.pterodactylus.sone.data.*; -import net.pterodactylus.sone.data.Album; -import net.pterodactylus.sone.data.Image; -import net.pterodactylus.sone.data.Sone; - -import com.google.common.base.Optional; -import com.google.common.hash.Hasher; -import com.google.common.hash.Hashing; +import static com.google.common.base.Preconditions.*; +import static java.nio.charset.StandardCharsets.*; /** * Container for image metadata. @@ -146,93 +138,94 @@ public class ImageImpl implements Image { public Modifier modify() throws IllegalStateException { // TODO: reenable check for local images return new Modifier() { - private Optional sone = absent(); - - private Optional creationTime = absent(); - - private Optional key = absent(); - - private Optional title = absent(); - - private Optional description = absent(); - - private Optional width = absent(); - - private Optional height = absent(); + @Nullable + private Sone sone; + @Nullable + private Long creationTime; + @Nullable + private String key; + @Nullable + private String title; + @Nullable + private String description; + @Nullable + private Integer width; + @Nullable + private Integer height; @Override public Modifier setSone(Sone sone) { - this.sone = fromNullable(sone); + this.sone = sone; return this; } @Override public Modifier setCreationTime(long creationTime) { - this.creationTime = of(creationTime); + this.creationTime = creationTime; return this; } @Override public Modifier setKey(String key) { - this.key = fromNullable(key); + this.key = key; return this; } @Override public Modifier setTitle(String title) { - this.title = fromNullable(title); + this.title = title; return this; } @Override public Modifier setDescription(String description) { - this.description = fromNullable(description); + this.description = description; return this; } @Override public Modifier setWidth(int width) { - this.width = of(width); + this.width = width; return this; } @Override public Modifier setHeight(int height) { - this.height = of(height); + this.height = height; return this; } @Override public Image update() throws IllegalStateException { - checkState(!sone.isPresent() || (ImageImpl.this.sone == null) || sone.get().equals(ImageImpl.this.sone), "can not change Sone once set"); - checkState(!creationTime.isPresent() || ((ImageImpl.this.creationTime == 0) || (ImageImpl.this.creationTime == creationTime.get())), "can not change creation time once set"); - checkState(!key.isPresent() || (ImageImpl.this.key == null) || key.get().equals(ImageImpl.this.key), "can not change key once set"); - if (title.isPresent() && title.get().trim().isEmpty()) { + checkState(sone == null || (ImageImpl.this.sone == null) || sone.equals(ImageImpl.this.sone), "can not change Sone once set"); + checkState(creationTime == null || ((ImageImpl.this.creationTime == 0) || (ImageImpl.this.creationTime == creationTime)), "can not change creation time once set"); + checkState(key == null || (ImageImpl.this.key == null) || key.equals(ImageImpl.this.key), "can not change key once set"); + if (title != null && title.trim().isEmpty()) { throw new ImageTitleMustNotBeEmpty(); } - checkState(!width.isPresent() || (ImageImpl.this.width == 0) || width.get().equals(ImageImpl.this.width), "can not change width once set"); - checkState(!height.isPresent() || (ImageImpl.this.height == 0) || height.get().equals(ImageImpl.this.height), "can not change height once set"); + checkState(width == null || (ImageImpl.this.width == 0) || width.equals(ImageImpl.this.width), "can not change width once set"); + checkState(height == null || (ImageImpl.this.height == 0) || height.equals(ImageImpl.this.height), "can not change height once set"); - if (sone.isPresent()) { - ImageImpl.this.sone = sone.get(); + if (sone != null) { + ImageImpl.this.sone = sone; } - if (creationTime.isPresent()) { - ImageImpl.this.creationTime = creationTime.get(); + if (creationTime != null) { + ImageImpl.this.creationTime = creationTime; } - if (key.isPresent()) { - ImageImpl.this.key = key.get(); + if (key != null) { + ImageImpl.this.key = key; } - if (title.isPresent()) { - ImageImpl.this.title = title.get(); + if (title != null) { + ImageImpl.this.title = title; } - if (description.isPresent()) { - ImageImpl.this.description = description.get(); + if (description != null) { + ImageImpl.this.description = description; } - if (width.isPresent()) { - ImageImpl.this.width = width.get(); + if (width != null) { + ImageImpl.this.width = width; } - if (height.isPresent()) { - ImageImpl.this.height = height.get(); + if (height != null) { + ImageImpl.this.height = height; } return ImageImpl.this; diff --git a/src/main/java/net/pterodactylus/sone/freenet/wot/IdentityLoader.java b/src/main/java/net/pterodactylus/sone/freenet/wot/IdentityLoader.java index 0917130..b446e71 100644 --- a/src/main/java/net/pterodactylus/sone/freenet/wot/IdentityLoader.java +++ b/src/main/java/net/pterodactylus/sone/freenet/wot/IdentityLoader.java @@ -17,17 +17,15 @@ package net.pterodactylus.sone.freenet.wot; -import static java.util.concurrent.TimeUnit.*; -import static net.pterodactylus.sone.freenet.wot.Context.*; - import java.util.*; import java.util.logging.*; +import javax.annotation.*; -import net.pterodactylus.sone.freenet.plugin.*; - -import com.google.common.base.Optional; import com.google.common.base.*; import com.google.inject.*; +import net.pterodactylus.sone.freenet.plugin.*; + +import static java.util.concurrent.TimeUnit.*; /** * Loads {@link OwnIdentity}s and the {@link Identity}s they trust. @@ -36,14 +34,15 @@ public class IdentityLoader { private final Logger logger = Logger.getLogger(IdentityLoader.class.getName()); private final WebOfTrustConnector webOfTrustConnector; - private final Optional context; + @Nullable + private final Context context; public IdentityLoader(WebOfTrustConnector webOfTrustConnector) { - this(webOfTrustConnector, Optional.absent()); + this(webOfTrustConnector, null); } @Inject - public IdentityLoader(WebOfTrustConnector webOfTrustConnector, Optional context) { + public IdentityLoader(WebOfTrustConnector webOfTrustConnector, @Nullable Context context) { this.webOfTrustConnector = webOfTrustConnector; this.context = context; } @@ -65,7 +64,7 @@ public class IdentityLoader { } Stopwatch stopwatch = Stopwatch.createStarted(); - Set trustedIdentities = webOfTrustConnector.loadTrustedIdentities(ownIdentity, context.transform(extractContext)); + Set trustedIdentities = webOfTrustConnector.loadTrustedIdentities(ownIdentity, (context == null) ? null : context.getContext()); logger.fine("Loaded " + trustedIdentities.size() + " identities for " + ownIdentity.getNickname() + " in " + (stopwatch.elapsed(MILLISECONDS) / 1000.0) + "s."); currentIdentities.put(ownIdentity, trustedIdentities); } @@ -74,7 +73,7 @@ public class IdentityLoader { } private boolean identityDoesNotHaveTheCorrectContext(OwnIdentity ownIdentity) { - return context.isPresent() && !ownIdentity.hasContext(context.transform(extractContext).get()); + return (context != null) && !ownIdentity.hasContext(context.getContext()); } } diff --git a/src/main/java/net/pterodactylus/sone/freenet/wot/WebOfTrustConnector.java b/src/main/java/net/pterodactylus/sone/freenet/wot/WebOfTrustConnector.java index c1dbef9..a67ba82 100644 --- a/src/main/java/net/pterodactylus/sone/freenet/wot/WebOfTrustConnector.java +++ b/src/main/java/net/pterodactylus/sone/freenet/wot/WebOfTrustConnector.java @@ -28,6 +28,8 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.logging.Level; import java.util.logging.Logger; +import javax.annotation.*; + import net.pterodactylus.sone.freenet.plugin.PluginConnector; import net.pterodactylus.sone.freenet.plugin.PluginException; import net.pterodactylus.sone.freenet.plugin.event.ReceivedReplyEvent; @@ -124,7 +126,7 @@ public class WebOfTrustConnector { * if an error occured talking to the Web of Trust plugin */ public Set loadTrustedIdentities(OwnIdentity ownIdentity) throws PluginException { - return loadTrustedIdentities(ownIdentity, Optional.absent()); + return loadTrustedIdentities(ownIdentity, null); } /** @@ -139,8 +141,8 @@ public class WebOfTrustConnector { * @throws PluginException * if an error occured talking to the Web of Trust plugin */ - public Set loadTrustedIdentities(OwnIdentity ownIdentity, Optional context) throws PluginException { - Reply reply = performRequest(SimpleFieldSetConstructor.create().put("Message", "GetIdentitiesByScore").put("Truster", ownIdentity.getId()).put("Selection", "+").put("Context", context.or("")).put("WantTrustValues", "true").get()); + public Set loadTrustedIdentities(OwnIdentity ownIdentity, @Nullable String context) throws PluginException { + Reply reply = performRequest(SimpleFieldSetConstructor.create().put("Message", "GetIdentitiesByScore").put("Truster", ownIdentity.getId()).put("Selection", "+").put("Context", (context ==null) ? "" : context).put("WantTrustValues", "true").get()); SimpleFieldSet fields = reply.getFields(); Set identities = new HashSet<>(); int identityCounter = -1; diff --git a/src/test/java/net/pterodactylus/sone/freenet/wot/IdentityManagerTest.java b/src/test/java/net/pterodactylus/sone/freenet/wot/IdentityManagerTest.java index 45e95db..62f91b8 100644 --- a/src/test/java/net/pterodactylus/sone/freenet/wot/IdentityManagerTest.java +++ b/src/test/java/net/pterodactylus/sone/freenet/wot/IdentityManagerTest.java @@ -19,7 +19,7 @@ public class IdentityManagerTest { private final EventBus eventBus = mock(EventBus.class); private final WebOfTrustConnector webOfTrustConnector = mock(WebOfTrustConnector.class); - private final IdentityManager identityManager = new IdentityManagerImpl(eventBus, webOfTrustConnector, new IdentityLoader(webOfTrustConnector, of(new Context("Test")))); + private final IdentityManager identityManager = new IdentityManagerImpl(eventBus, webOfTrustConnector, new IdentityLoader(webOfTrustConnector, new Context("Test"))); @Test public void identityManagerPingsWotConnector() throws PluginException { diff --git a/src/test/java/net/pterodactylus/sone/test/Matchers.java b/src/test/java/net/pterodactylus/sone/test/Matchers.java index d04da0f..5d2d641 100644 --- a/src/test/java/net/pterodactylus/sone/test/Matchers.java +++ b/src/test/java/net/pterodactylus/sone/test/Matchers.java @@ -22,6 +22,8 @@ import static java.util.regex.Pattern.compile; import java.io.IOException; import java.io.InputStream; +import javax.annotation.*; + import net.pterodactylus.sone.data.Album; import net.pterodactylus.sone.data.Image; import net.pterodactylus.sone.data.Post; @@ -91,8 +93,7 @@ public class Matchers { }; } - public static Matcher isPost(String postId, long time, - String text, Optional recipient) { + public static Matcher isPost(String postId, long time, String text, @Nullable String recipient) { return new PostMatcher(postId, time, text, recipient); } @@ -229,10 +230,10 @@ public class Matchers { private final String postId; private final long time; private final String text; - private final Optional recipient; + @Nullable + private final String recipient; - private PostMatcher(String postId, long time, String text, - Optional recipient) { + private PostMatcher(String postId, long time, String text, @Nullable String recipient) { this.postId = postId; this.time = time; this.text = text; @@ -257,15 +258,15 @@ public class Matchers { .appendValue(text); return false; } - if (recipient.isPresent()) { + if (recipient != null) { if (!post.getRecipientId().isPresent()) { mismatchDescription.appendText( "Recipient not present"); return false; } - if (!post.getRecipientId().get().equals(recipient.get())) { + if (!post.getRecipientId().get().equals(recipient)) { mismatchDescription.appendText("Recipient is not ") - .appendValue(recipient.get()); + .appendValue(recipient); return false; } } else { @@ -283,9 +284,9 @@ public class Matchers { .appendValue(postId); description.appendText(", created at @").appendValue(time); description.appendText(", text ").appendValue(text); - if (recipient.isPresent()) { + if (recipient != null) { description.appendText(", directed at ") - .appendValue(recipient.get()); + .appendValue(recipient); } } diff --git a/src/test/kotlin/net/pterodactylus/sone/core/ConfigurationSoneParserTest.kt b/src/test/kotlin/net/pterodactylus/sone/core/ConfigurationSoneParserTest.kt index 6f93cd4..90e3fa6 100644 --- a/src/test/kotlin/net/pterodactylus/sone/core/ConfigurationSoneParserTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/core/ConfigurationSoneParserTest.kt @@ -95,8 +95,8 @@ class ConfigurationSoneParserTest { val postBuilderFactory = createPostBuilderFactory() val posts = configurationSoneParser.parsePosts(postBuilderFactory) assertThat(posts, containsInAnyOrder( - isPost("P0", 1000L, "T0", absent()), - isPost("P1", 1001L, "T1", of("1234567890123456789012345678901234567890123")) + isPost("P0", 1000L, "T0", null), + isPost("P1", 1001L, "T1", "1234567890123456789012345678901234567890123") )) } @@ -149,7 +149,7 @@ class ConfigurationSoneParserTest { fun postWithInvalidRecipientIdIsRecognized() { setupPostWithInvalidRecipientId() val posts = configurationSoneParser.parsePosts(createPostBuilderFactory()) - assertThat(posts, contains(isPost("P0", 1000L, "T0", absent()))) + assertThat(posts, contains(isPost("P0", 1000L, "T0", null))) } private fun setupPostWithInvalidRecipientId() { diff --git a/src/test/kotlin/net/pterodactylus/sone/database/memory/MemoryDatabaseTest.kt b/src/test/kotlin/net/pterodactylus/sone/database/memory/MemoryDatabaseTest.kt index 46796ab..5d4fe3f 100644 --- a/src/test/kotlin/net/pterodactylus/sone/database/memory/MemoryDatabaseTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/database/memory/MemoryDatabaseTest.kt @@ -50,8 +50,8 @@ class MemoryDatabaseTest { @Test fun `stored sone is made available`() { storeSone() - assertThat(memoryDatabase.getPost("post1"), isPost("post1", 1000L, "post1", absent())) - assertThat(memoryDatabase.getPost("post2"), isPost("post2", 2000L, "post2", of(RECIPIENT_ID))) + assertThat(memoryDatabase.getPost("post1"), isPost("post1", 1000L, "post1", null)) + assertThat(memoryDatabase.getPost("post2"), isPost("post2", 2000L, "post2", RECIPIENT_ID)) assertThat(memoryDatabase.getPost("post3"), nullValue()) assertThat(memoryDatabase.getPostReply("reply1"), isPostReply("reply1", "post1", 3000L, "reply1")) assertThat(memoryDatabase.getPostReply("reply2"), isPostReply("reply2", "post2", 4000L, "reply2")) diff --git a/src/test/kotlin/net/pterodactylus/sone/freenet/wot/IdentityLoaderTest.kt b/src/test/kotlin/net/pterodactylus/sone/freenet/wot/IdentityLoaderTest.kt index 5c363fc..07126bb 100644 --- a/src/test/kotlin/net/pterodactylus/sone/freenet/wot/IdentityLoaderTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/freenet/wot/IdentityLoaderTest.kt @@ -33,7 +33,7 @@ import org.mockito.Mockito.verify class IdentityLoaderTest { private val webOfTrustConnector = mock() - private val identityLoader = IdentityLoader(webOfTrustConnector, of(Context("Test"))) + private val identityLoader = IdentityLoader(webOfTrustConnector, Context("Test")) private val identityLoaderWithoutContext = IdentityLoader(webOfTrustConnector) @Before @@ -84,10 +84,10 @@ class IdentityLoaderTest { val ownIdentities = createOwnIdentities() val identities = identityLoader.loadIdentities() verify(webOfTrustConnector).loadAllOwnIdentities() - verify(webOfTrustConnector).loadTrustedIdentities(eq(ownIdentities[0]), eq(of("Test"))) - verify(webOfTrustConnector).loadTrustedIdentities(eq(ownIdentities[1]), eq(of("Test"))) + verify(webOfTrustConnector).loadTrustedIdentities(eq(ownIdentities[0]), eq("Test")) + verify(webOfTrustConnector).loadTrustedIdentities(eq(ownIdentities[1]), eq("Test")) verify(webOfTrustConnector, never()).loadTrustedIdentities(eq(ownIdentities[2]), any()) - verify(webOfTrustConnector).loadTrustedIdentities(eq(ownIdentities[3]), eq(of("Test"))) + verify(webOfTrustConnector).loadTrustedIdentities(eq(ownIdentities[3]), eq("Test")) assertThat(identities.keys, hasSize(4)) assertThat(identities.keys, containsInAnyOrder(ownIdentities[0], ownIdentities[1], ownIdentities[2], ownIdentities[3])) verifyIdentitiesForOwnIdentity(identities, ownIdentities[0], createTrustedIdentitiesForFirstOwnIdentity()) @@ -101,10 +101,10 @@ class IdentityLoaderTest { val ownIdentities = createOwnIdentities() val identities = identityLoaderWithoutContext.loadIdentities() verify(webOfTrustConnector).loadAllOwnIdentities() - verify(webOfTrustConnector).loadTrustedIdentities(eq(ownIdentities[0]), eq(absent())) - verify(webOfTrustConnector).loadTrustedIdentities(eq(ownIdentities[1]), eq(absent())) - verify(webOfTrustConnector).loadTrustedIdentities(eq(ownIdentities[2]), eq(absent())) - verify(webOfTrustConnector).loadTrustedIdentities(eq(ownIdentities[3]), eq(absent())) + verify(webOfTrustConnector).loadTrustedIdentities(eq(ownIdentities[0]), eq(null)) + verify(webOfTrustConnector).loadTrustedIdentities(eq(ownIdentities[1]), eq(null)) + verify(webOfTrustConnector).loadTrustedIdentities(eq(ownIdentities[2]), eq(null)) + verify(webOfTrustConnector).loadTrustedIdentities(eq(ownIdentities[3]), eq(null)) assertThat(identities.keys, hasSize(4)) val firstOwnIdentity = ownIdentities[0] val secondOwnIdentity = ownIdentities[1] -- 2.7.4