X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fcore%2FSoneInserter.java;h=1e93aa67229bca4fa4a8741ba8346bb51ee78bd3;hb=c74a6b50636ab4c13967ac90fa4155eea028b836;hp=46a3fe781ac6de9bdfdb9950b9308a52177fa4ee;hpb=88731847148b7fbea5d578abe968d42daf3d1b58;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/core/SoneInserter.java b/src/main/java/net/pterodactylus/sone/core/SoneInserter.java index 46a3fe7..1e93aa6 100644 --- a/src/main/java/net/pterodactylus/sone/core/SoneInserter.java +++ b/src/main/java/net/pterodactylus/sone/core/SoneInserter.java @@ -116,12 +116,17 @@ public class SoneInserter extends AbstractService { * The Sone to insert */ public SoneInserter(Core core, EventBus eventBus, FreenetInterface freenetInterface, Sone sone) { + this(core, eventBus, freenetInterface, sone, new SoneModificationDetector(core, sone, insertionDelay)); + } + + @VisibleForTesting + SoneInserter(Core core, EventBus eventBus, FreenetInterface freenetInterface, Sone sone, SoneModificationDetector soneModificationDetector) { super("Sone Inserter for “" + sone.getName() + "”", false); this.core = core; this.eventBus = eventBus; this.freenetInterface = freenetInterface; this.sone = sone; - this.soneModificationDetector = new SoneModificationDetector(core, sone, insertionDelay); + this.soneModificationDetector = soneModificationDetector; } // @@ -136,7 +141,7 @@ public class SoneInserter extends AbstractService { * @return This Sone inserter */ public SoneInserter setSone(Sone sone) { - checkArgument((this.sone == null) || sone.equals(this.sone), "Sone to insert can not be set to a different Sone"); + checkArgument(sone.equals(this.sone), "Sone to insert can not be set to a different Sone"); this.sone = sone; return this; } @@ -265,7 +270,8 @@ public class SoneInserter extends AbstractService { * * @author David ‘Bombe’ Roden */ - private class InsertInformation { + @VisibleForTesting + class InsertInformation { private final String fingerprint; @@ -297,7 +303,8 @@ public class SoneInserter extends AbstractService { // ACCESSORS // - private String getFingerprint() { + @VisibleForTesting + String getFingerprint() { return fingerprint; }